“Dodaj rolę własnej za pomocą Bot Python” Kod odpowiedzi

Dodaj rolę własnej za pomocą Bot Python

@async def on_message(message):
     if message.content == "give me admin"
           role = discord.utils.get(server.roles, name="Admin")
           await client.add_roles(message.author.id, role)
Encouraging Emu

Dodaj rolę własnej za pomocą Bot Python


from discord.ext import commands
from discord.utils import get

bot = commands.Bot(command_prefix='!')

@bot.command(pass_context=True)
@commands.has_role("Admin") # This must be exactly the name of the appropriate role
async def addrole(ctx):
    member = ctx.message.author
    role = get(member.server.roles, name="Test")
    await bot.add_roles(member, role)

Wide-eyed Wildebeest

Odpowiedzi podobne do “Dodaj rolę własnej za pomocą Bot Python”

Pytania podobne do “Dodaj rolę własnej za pomocą Bot Python”

Więcej pokrewnych odpowiedzi na “Dodaj rolę własnej za pomocą Bot Python” w Python

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu