I'm new a this :) this is the first code can't I add more?
I'm using discord.js
enter image description here
The question is a bit unclear. But if sending the embed multiple times is what you want you could put the channel.send(exampleEmbed) inside a for loop
Related
I'm doing a discord bot using discord.py and one of the functions I want to add is on a command !gif it sends a random gif from tenor. Is it possible to do that? So basically what I need is an explanation as to how to fetch GIFs from tenor.
You would need to query Tenors random gif api:
https://tenor.com/gifapi/documentation#endpoints-random
This requires you to provide a search term and will return a randomised list of gif for that keyword.
You can then respond to the command with either a link to the gif or the gif itself as a file.
Basic thing I just need fixed; wanting to download a file from attachment but i'm not sure how to describe the attachment as an object/file.
I just have this:
let jimage = message.attachments.first()
fs.writeFileSync(`./${jimage.filename}`, jimage)
Only issue is that, for FS's second argument, discord doesn't have a selection for just the file. Reason i'm trying this way is because I took this idea from here:
how to save an image from discord using discord bot node js
But "attachment.file" isn't a real thing. Other threads show just really overly complicated methods with new calls, like something called request, I just wanna do this straight off fs and discord.
I found a pretty simple solution using this line over here:
request(message.attachments.first().url).pipe(fs.createWriteStream('image.png'))
It basically finds where file is stored on the discord website and using "request" gets it from there. To keep file's name you can use message.attachments.first.name if you need to. Unfortunately I haven't found out how to save file type. If any questions, I will try to help!
P.S. don't forget to define and download the "request" module.
I’m writing a simple bot for a discord server, and I’m trying to explore a few different ideas and two of them require some kind of response and sub command based on responses. I want people to be able to poll something without it being done through reacting to a bots post. I’m unsure of how to go about this.
I’ll give one as an example.
Ideally, it could be structured something like this.
[initiate poll command] [poll name]
Then to respond, a user could do something like this:
[poll name] [yes/no]
Or for a pseudo-code example:
!start_poll Lets_do_this
!lets_do_this yes
Then if it meets a certain threshold of yes’s, a sub command would execute.
My idea would be to create a dictionary. Whenever someone starts a poll, you would add two keys to the dictionary: "[name]_yes", and "[name]_no". Each key would have an empty list. I would then use a command such as "!vote [poll] [yes/no]" to simplify the coding, and whenever somebody voted, I would add their discord ID to the corresponding list. It would be a good idea to check if their name is already on a list, however. Then if you wanted, you could take the size of each list to see how many people have voted for each. The dictionary would end up looking something like:
{
'lets_do_this_yes': ['Bob', 'Suzy'],
'lets_do_this_no': ['Dan'],
'lets_do_this_instead_yes': ['Dan','Joe'],
'lets_do_this_instead_no': ['Suzy']
}
Note: I haven't used discord.py, but I have experience with Python and Discord.JS
Hopefully this works for you.
Edit: The result example above would not actually have their Discord name, but rather their Discord ID, as that is unique to them where as their name can be changed.
I am trying to create a spreadsheet for a World of Warcraft community, based on certain posts/events happening where we #tag the involved people. We would then normally go to our excel sheet and enter manually the names of the participants and all the rest of the details.
I have been trying to do it with Zapier, and i managed to fix all my rules/steps, but the moment i #tag anyone, the text sent/parsed is " !185020918530048000> " instead of "Loco-Silvermoon" for example.
Please help, any insight would be most welcome.
Anyone got an idea about that? or any Bot/Platform that would work around that? My thought process took me two solutions. Either get a bot to replicate all the chat happening on that channel to another private channel that only i can see and where tagging is not allowed (no idea if that exists or work). OR, get a Bot with a plaintext option that would just send me the text instead of the tagtext.
I am wresting to sort email messages which I got using this api
https://developers.google.com/gmail/api/v1/reference/users/messages/list
Does anybody know how gmail api send this messages?
Do they send messages in order?
Thanks
Go to Users.messages.list and Execute the Try-it. You will notice that the threadIds of messages appear in descending order with the newest one appearing on top. Also confirmed in this SO post.
I recently looked into the same issue and wrote a short python prototype - feel free to take a look, it is publicly available on Github: https://github.com/jan-janssen/pygmailsorter
As #reyanthonyrenacia already pointed out the key part is using Users.messages.list, I then combine this with Users.messages.get to receive the full message and finally add or remove the label using the Users.messages.modify action.