discord.py

On message delete message Discord.py

我是研究僧i 提交于 2021-01-04 06:23:33
问题 import discord import asyncio client = discord.Client() @client.event async def on_ready(): print ("I’m Now Online") @client.event async def on_message(message): if message.author == client.user: return elif message.content.startswith("deletethis"): I’m wonder how I could be able to add to this to delete the above command when the author of the message sends the command above. May someone help create one? I’ve tried my self by brain and didn’t find anything online so I’m looking for some help

On message delete message Discord.py

纵饮孤独 提交于 2021-01-04 06:22:17
问题 import discord import asyncio client = discord.Client() @client.event async def on_ready(): print ("I’m Now Online") @client.event async def on_message(message): if message.author == client.user: return elif message.content.startswith("deletethis"): I’m wonder how I could be able to add to this to delete the above command when the author of the message sends the command above. May someone help create one? I’ve tried my self by brain and didn’t find anything online so I’m looking for some help

Send multiple embeds in one message with Discord.py

元气小坏坏 提交于 2021-01-01 19:48:18
问题 I've been trying to send a list of embeds in a single message using discord.py. I've seen it was possible in discord.py's documentation: https://discordpy.readthedocs.io/en/latest/api.html send(content=None, *, wait=False, username=None, avatar_url=None, tts=False, file=None, files=None, embed=None, embeds=None ) embeds (List[Embed]) – A list of embeds to send with the content. Maximum of 10. This cannot be mixed with the embed parameter. However, I get an error message when I try to pass the

How to edit embed messages - discord.py

坚强是说给别人听的谎言 提交于 2021-01-01 09:16:12
问题 How do I edit an embed in discord.py ? I have tried msg.edit(embed = embed) but it just edits the message with <discord.embeds.Embed object at 0x000001824D3F5A68> 回答1: To provide an alternative answer to the one already given, you should be able to edit an embed of a given message like this : from discord import Embed ... first_embed = Embed(title='embed 1') new_embed = Embed(title='embed 2') # send a first message with an embed msg = await ctx.send(embed=first_embed) # edit the embed of the

Executing run_coroutine_threadsafe in a separate thread

丶灬走出姿态 提交于 2021-01-01 04:20:09
问题 I have a script that is constantly running forever (it checks changes in files). I need to send Discord messages whenever a weird file is made. Problem is, the event watching function ( def run(self): below) is from a subclass, so I can't change it to async def run(self): . Therefore I can't use await channel.send() My solution to this was to use run_coroutine_threadsafe like explained here: https://stackoverflow.com/a/53726266/9283107. That works good! But the problem is, the messages get

Executing run_coroutine_threadsafe in a separate thread

别来无恙 提交于 2021-01-01 04:20:08
问题 I have a script that is constantly running forever (it checks changes in files). I need to send Discord messages whenever a weird file is made. Problem is, the event watching function ( def run(self): below) is from a subclass, so I can't change it to async def run(self): . Therefore I can't use await channel.send() My solution to this was to use run_coroutine_threadsafe like explained here: https://stackoverflow.com/a/53726266/9283107. That works good! But the problem is, the messages get

discord.py Music Bot: How to Combine a Play and Queue Command

三世轮回 提交于 2020-12-31 09:48:11
问题 Hello I'm trying to create a music bot but I want it so I can play music and add additional music to a queue with the same command. I've tried to do this but I can't get it to work. Here's the code with play and queue being two separate commands: @bot.command(pass_context=True) async def join(ctx): await bot.join_voice_channel(bot.get_channel('487315853482786820')) @bot.command(pass_context=True) async def leave(ctx): voice_client = bot.voice_client_in(ctx.message.server) await voice_client

discord.py rewrite | How to wait for author message?

佐手、 提交于 2020-12-30 03:23:06
问题 I am making a command which waits for a user to reply to the bot, but I would like the bot to only accept the author's reply. @client.command(name='numgame', brief='Guess a number between 1 and 100', pass_context=True) async def numgame(context): number = random.randint(1,100) guess = 4 while guess != 0: await context.send('Pick a number between 1 and 100') msg = await client.wait_for('message', check=check, timeout=30) attempt = int(msg.content) if attempt > number: await context.send(str

How to make a weather command using discord.py v1.4.1

橙三吉。 提交于 2020-12-30 02:41:48
问题 In case you would like to make a weather command using discord.py and have a cool addition to your bot, I got you covered, I have answered below on how to create a weather command in discord.py. 回答1: We will be making a command which will work like this - Starting off, we are going to be using openweahtermap API, which requires an API key, you can get one for free by simple logging in to their website. Once you have got the API key, you are all good to go. The second step will be to start

How to make a weather command using discord.py v1.4.1

北慕城南 提交于 2020-12-30 02:38:45
问题 In case you would like to make a weather command using discord.py and have a cool addition to your bot, I got you covered, I have answered below on how to create a weather command in discord.py. 回答1: We will be making a command which will work like this - Starting off, we are going to be using openweahtermap API, which requires an API key, you can get one for free by simple logging in to their website. Once you have got the API key, you are all good to go. The second step will be to start