@bot.command(pass_context=True)
async def test(ctx, *, msg):
for server in bot.servers:
for channel in server.channels:
try:
await bot.send_message(channel, msg)
except Exception:
continue
else:
break
import discord
from discord.ext import commands
from discord import utils
Token = ''
bot = commands.Bot(command_prefix='!')
keys = ['123']
@bot.event
async def on_ready():
Print(“Connect”)
@bot.command(pass_context=True)
async def key(member):
channel = bot.get_channel(696906816935952414)
role = discord.utils.get(member.guild.roles, id=696905872395468873)
if arg.lower() in keys:
await member.add_roles(role)
else:
await channel.send("Ключ не подходит!")
bot.run(Token)