What do you want to save?
Add Code snippet
New code examples
-
Python 2022-02-01 21:06:00
how to make it that your discord bot can autorole in the discord.py rewrite
role = "Citizen" # Role to be autoroled when user joins @client.event async def on_member_join(member): rank = discord.utils.get(member.guild.roles, name=role) #Bot get guild(server) roles await member.add_roles(rank) print(f"... Add solution -
Python 2021-11-09 21:14:18
adding roles discord py
# If ctx is not defined and you are handling a message, use this code ctx = await bot.get_context(message) # This is the code needed to give a user a role member = ctx.message.author # Member object that you want to add the role to role = discord.utils.g... Add solution -
Python 2021-10-29 03:55:18
discord.py play mp3 file
@bot.command(aliases=['paly', 'queue', 'que']) async def play(ctx): guild = ctx.guild voice_client: discord.VoiceClient = discord.utils.get(bot.voice_clients, guild=guild) audio_source = discord.FFmpegPCMAudio('vuvuzela.mp3') if not voice_... Add solution -
Python 2021-10-10 06:49:07
bot that only responds to certain roles discord.py
if message.content.lower().startswith('/role'): user = message.author if message.channel.is_private or discord.utils.get(user.roles, name="admin") is None: return role = discord.utils.get(user.server.roles, id="4379232... Add solution -
Other 2021-10-09 16:37:05
how to make timed mute in discord.py
@client.command(description="Mutes the specified user.") @commands.has_permissions(manage_messages=True) async def mute(ctx, member: discord.Member, *, reason=None): guild = ctx.guild mutedRole = discord.utils.get(guild.roles, name="... Add solution