discord.py

Discord.py on_member_join wont print

半腔热情 提交于 2021-02-10 15:45:46
问题 @client.event async def on_member_join(member): print(member) role = discord.utils.get(member.guild.roles, name="☾│Unregister Of Hyperion") await member.add_roles(role) This is my code, it should print the users nick when it joins, but it doesn't. The bot gives the role but it doesnt print. The same code works on my other bot. I have no idea why it doesnt work in this. 回答1: In the new version of discord.py(1.5.x), there're some updates about Intents . Intents are similar to permissions, you

How to loop with a reaction embed menu

你说的曾经没有我的故事 提交于 2021-02-10 15:43:18
问题 What I'm trying to do : Learning to make a proper help menu for my discord.py bot by having the ctx.message.author react to the message with the reactions given. The bot checks if they've been reacted to, then edits the message. If the ctx.message.author un-reacts, it goes back to the first menu (menuu). Problem(s) : I'm not sure how to loop through this until the timeout runs out. I'm also not sure how to check if the user un-reacts to the message. Error(s) : No errors. @client.command()

How to loop with a reaction embed menu

末鹿安然 提交于 2021-02-10 15:42:02
问题 What I'm trying to do : Learning to make a proper help menu for my discord.py bot by having the ctx.message.author react to the message with the reactions given. The bot checks if they've been reacted to, then edits the message. If the ctx.message.author un-reacts, it goes back to the first menu (menuu). Problem(s) : I'm not sure how to loop through this until the timeout runs out. I'm also not sure how to check if the user un-reacts to the message. Error(s) : No errors. @client.command()

discord.py - Automaticaly Change an Role Color

浪尽此生 提交于 2021-02-10 13:22:53
问题 I was trying to make so the role RGB Changes to color red and yellow every 5 seconds async def runtime_background_task(role = discord.Role): while not bot.is_closed: await bot.edit_role(server="493121776402825219", role="RGB", colour=discord.Colour(0xff0000)) await asyncio.sleep(5) await bot.edit_role(server="493121776402825219", role="RGB", colour=discord.Colour(0xffff00)) 回答1: You can try something like this @bot.event async def on_ready(): server = bot.get_server("493121776402825219")

discord.py - Automaticaly Change an Role Color

流过昼夜 提交于 2021-02-10 13:22:27
问题 I was trying to make so the role RGB Changes to color red and yellow every 5 seconds async def runtime_background_task(role = discord.Role): while not bot.is_closed: await bot.edit_role(server="493121776402825219", role="RGB", colour=discord.Colour(0xff0000)) await asyncio.sleep(5) await bot.edit_role(server="493121776402825219", role="RGB", colour=discord.Colour(0xffff00)) 回答1: You can try something like this @bot.event async def on_ready(): server = bot.get_server("493121776402825219")

How to capture output of subprocess.call

最后都变了- 提交于 2021-02-10 05:15:10
问题 I have made a script that tells me the temperature of my Raspberry Pi 3, but there is a problem with the script. The result output is the bot saying "Your RPI3 temp is currently 0". What is wrong with my code? @bot.command(pass_context=True) async def vcgencmdmeasure_temp(ctx): if ctx.message.author.id == "412372079242117123": await bot.say("OK....") return_code = subprocess.call("vcgencmd measure_temp", shell=True) await bot.say("KK done") await bot.say("Your RPI3 temp is currently: {}"

How to capture output of subprocess.call

妖精的绣舞 提交于 2021-02-10 05:14:30
问题 I have made a script that tells me the temperature of my Raspberry Pi 3, but there is a problem with the script. The result output is the bot saying "Your RPI3 temp is currently 0". What is wrong with my code? @bot.command(pass_context=True) async def vcgencmdmeasure_temp(ctx): if ctx.message.author.id == "412372079242117123": await bot.say("OK....") return_code = subprocess.call("vcgencmd measure_temp", shell=True) await bot.say("KK done") await bot.say("Your RPI3 temp is currently: {}"

How to capture output of subprocess.call

浪尽此生 提交于 2021-02-10 05:13:34
问题 I have made a script that tells me the temperature of my Raspberry Pi 3, but there is a problem with the script. The result output is the bot saying "Your RPI3 temp is currently 0". What is wrong with my code? @bot.command(pass_context=True) async def vcgencmdmeasure_temp(ctx): if ctx.message.author.id == "412372079242117123": await bot.say("OK....") return_code = subprocess.call("vcgencmd measure_temp", shell=True) await bot.say("KK done") await bot.say("Your RPI3 temp is currently: {}"

How to make a bot join voice channels discord.py

怎甘沉沦 提交于 2021-02-09 10:58:09
问题 I'm using discord.py to create a music bot, but I'm having trouble connecting the bot to a voice channel. Im using a Cog to seperate the music features from the rest. @commands.command() async def join_voice(self, ctx): channel = ctx.author.voice.channel print(channel.id) await self.client.VoiceChannel.connect() But I get the error: AttributeError: 'NoneType' object has no attribute 'channel' I've looked all through the docs and all the similar questions on here and still no solutions! Could

How to make a bot join voice channels discord.py

可紊 提交于 2021-02-09 10:58:04
问题 I'm using discord.py to create a music bot, but I'm having trouble connecting the bot to a voice channel. Im using a Cog to seperate the music features from the rest. @commands.command() async def join_voice(self, ctx): channel = ctx.author.voice.channel print(channel.id) await self.client.VoiceChannel.connect() But I get the error: AttributeError: 'NoneType' object has no attribute 'channel' I've looked all through the docs and all the similar questions on here and still no solutions! Could