Answer the question
In order to leave comments, you need to log in
Discord.py is it possible to make a one-time command?
I made a command for the bot that creates the MUTED role so that the !mute command that issues this role is used correctly. Here is the command itself:
@bot.command()
@commands.has_permissions(Administrator= True)
async def start(ctx):
guild = ctx.guild
perms = discord.Permissions(send_message=False)
await guild.create_role(name="MUTED", Permissions=perms)
await ctx.send(embed = discord.Embed(description = '''Первоначальная настройка бота завершена!
Удачного пользования :)''', color = 0x49FF33))
Answer the question
In order to leave comments, you need to log in
The best option is to simply check if there is such a role by simply checking all the roles on the server:
async def findRoleByName(guild,name:str):
for role in guild.roles:
if name.lower() in role.name.lower():
return role #вернет сам объект роли
else:
return None
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question