discord.py

Discord.py @bot.event

筅森魡賤 提交于 2021-02-19 05:35:52
问题 So I have a script that uses both @bot.event and @bot.command() . The problem is that when I have a @bot.event waiting the @bot.command() will not run. Here is my code: @bot.event async def on_ready(): print("Bot Is Ready And Online!") async def react(message): if message.content == "Meeting": await message.add_reaction("👍") @bot.command() async def info(ctx): await ctx.send("Hello, thanks for testing out our bot. ~ techNOlogics") @bot.command(pass_context=True) async def meet(ctx,time): if

Latency command in Discord.py

巧了我就是萌 提交于 2021-02-18 22:41:30
问题 I've looked in a lot of places and I can't find a way to make a ping (latency) command using discord.py , something like this: @client.command(pass_context=True) async def pong(ctx): # Somehow find 'pingtime' await client.say(pingtime) 回答1: Really at this point you should be using the rewrite branch of discord.py This would be my solution using the commands extension. @bot.command() async def ping(ctx): await ctx.send('Pong! {0}'.format(round(bot.latency, 1))) 回答2: On the rewrite branch of

Latency command in Discord.py

时光怂恿深爱的人放手 提交于 2021-02-18 22:38:44
问题 I've looked in a lot of places and I can't find a way to make a ping (latency) command using discord.py , something like this: @client.command(pass_context=True) async def pong(ctx): # Somehow find 'pingtime' await client.say(pingtime) 回答1: Really at this point you should be using the rewrite branch of discord.py This would be my solution using the commands extension. @bot.command() async def ping(ctx): await ctx.send('Pong! {0}'.format(round(bot.latency, 1))) 回答2: On the rewrite branch of

List all guilds with multiple servers on a single embed

谁说我不能喝 提交于 2021-02-17 06:31:28
问题 This is my current code which shows the servers it is currently in. Which this does what I would like it to do, but it is not efficient and can be avoided instead of sending an embed message for each server it gets. @client.command() @commands.is_owner() async def list_guilds(ctx): servers = client.guilds for guild in servers: embed = discord.Embed(colour=0x7289DA) embed.set_footer(text=f"Guilds requested by {ctx.author}", icon_url=ctx.author.avatar_url) embed.add_field(name=(str(guild.name))

List all guilds with multiple servers on a single embed

最后都变了- 提交于 2021-02-17 06:31:08
问题 This is my current code which shows the servers it is currently in. Which this does what I would like it to do, but it is not efficient and can be avoided instead of sending an embed message for each server it gets. @client.command() @commands.is_owner() async def list_guilds(ctx): servers = client.guilds for guild in servers: embed = discord.Embed(colour=0x7289DA) embed.set_footer(text=f"Guilds requested by {ctx.author}", icon_url=ctx.author.avatar_url) embed.add_field(name=(str(guild.name))

discord.py How to add Mute command

允我心安 提交于 2021-02-16 15:19:24
问题 I'm making a discord bot and I really want to make a mute command to mute toxic users. This is the code I've currently done, this isn't the rewrite version. @bot.command(pass_context = True) async def mute(ctx, user_id, userName: discord.User): if ctx.message.author.server_permissions.administrator: user = ctx.message.author role = discord.utils.get(user.server.roles, name="Muted") await client.add_roles(user, role) else: embed=discord.Embed(title="Permission Denied.", description="You don't

discord.py How to add Mute command

孤街浪徒 提交于 2021-02-16 15:19:07
问题 I'm making a discord bot and I really want to make a mute command to mute toxic users. This is the code I've currently done, this isn't the rewrite version. @bot.command(pass_context = True) async def mute(ctx, user_id, userName: discord.User): if ctx.message.author.server_permissions.administrator: user = ctx.message.author role = discord.utils.get(user.server.roles, name="Muted") await client.add_roles(user, role) else: embed=discord.Embed(title="Permission Denied.", description="You don't

Discord bot python: discord.errors.ClientException: ffmpeg was not found

做~自己de王妃 提交于 2021-02-16 03:58:56
问题 I'm trying to make a discord bot that plays music in a voice channel. It connects to the voice channel, but doesn't play anything. It also gives an error in the console. I'm on Windows and I'm using the discord.py rewrite. My code: import discord, random, datetime, asyncio, nacl, ffmpeg TOKEN = 'What token' client = discord.Client() @client.event async def on_message(message): if message.content.lower() == '$play': if message.content.lower() == '$play': channel = client.get_channel

Discord bot python: discord.errors.ClientException: ffmpeg was not found

守給你的承諾、 提交于 2021-02-16 03:54:34
问题 I'm trying to make a discord bot that plays music in a voice channel. It connects to the voice channel, but doesn't play anything. It also gives an error in the console. I'm on Windows and I'm using the discord.py rewrite. My code: import discord, random, datetime, asyncio, nacl, ffmpeg TOKEN = 'What token' client = discord.Client() @client.event async def on_message(message): if message.content.lower() == '$play': if message.content.lower() == '$play': channel = client.get_channel

Discord bot python: discord.errors.ClientException: ffmpeg was not found

馋奶兔 提交于 2021-02-16 03:54:15
问题 I'm trying to make a discord bot that plays music in a voice channel. It connects to the voice channel, but doesn't play anything. It also gives an error in the console. I'm on Windows and I'm using the discord.py rewrite. My code: import discord, random, datetime, asyncio, nacl, ffmpeg TOKEN = 'What token' client = discord.Client() @client.event async def on_message(message): if message.content.lower() == '$play': if message.content.lower() == '$play': channel = client.get_channel