PDA

Просмотр полной версии : Дискорд бот


Raih
07.05.2021, 00:04
Не работает комманда мута.

Код:






import discord
from discord.ext import commands
from discord.ext.commands import Bot
Bot = commands.Bot(command_prefix=">")
hello_words = ["привет всем", "qq", "qq all", "привет", "здарова", "всем привет", "хай", "hi"]
info_words = ["кто создатель", "обратная связь"]
bye_words = ["bb", "всем пока", "пока", "бб"]

client = discord.Client()

@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))

@client.event
async def on_message(message):
if message.author == client.user:
return

msg = message.content.lower()
msg_list = msg.split()

#if (msg in hello_words) or len(list(set(msg_list+hello_words)))=0:
find_hello_words = True
if(find_hello_words):
await message.channel.send('Привет!')

#if (msg in info_words) or len(list(set(msg_list+info_words)))=0:
find_info_words = True
if (find_info_words):
await message.channel.send('Создал Бек!\nОбратная связь Бек#1337')

find_bye_words = False
for item in bye_words:
if msg.find(item)>=0:
find_bye_words = True
if(find_bye_words):
await message.channel.send('Пока!')

# print(msg_list)
# print(hello_words)
# print(list(set(msg_list+hello_words)))
# print(len(list(set(msg_list+hello_words))))

@Bot.command()
@commands.has_permissions(view_audit_log=True)
async def mute(ctx,member:discord.Member,time:int,reason):
muterole = discord.untils.get(ctx.guild.roles,id=839952960175 341638)
emb = discord.Embed(title="Мут",color=0xff0000)
emb.add_field(name='Модератор',value=ctx. message.author.mention,inline=False)
emb.add_field(name='Нарушитель',value=me mber.mention,inline=False)
emb.add_field(name='Причина',value=reason,i nline=False)
emb.add_field(name='Время',value=time,inline= False)
await ctx.send(embed = emb)

Raih
07.05.2021, 00:05
Строчка с токеном тоже есть, по понятным причинам писать ее не буду

whytspirit
14.06.2021, 04:06
где выдача роли?

await member.add_roles(mute_role)