Мой бот сохранит мой идентификатор, если я наберу -afk
, и когда другой пользователь упомянет меня, мой бот отправит сообщение, что я afk
.
Проблема в том, что мои if
операторы не работают, когда я пытаюсь проверить упомянутый идентификатор и идентификатор в afk_list
.
Вот проблема:
async def on_message(self, message):
mentioned = message.raw_mentions
if mentioned in afk_list:
print('Found!!')
await self.client.say('User is AFK')
Это весь мой код:
import discord
from discord.ext import commands
import datetime
afk_list = []
class Manage:
def __init__(self, client):
self.client = client
async def on_message(self, message):
mentioned = message.raw_mentions
if mentioned in afk_list:
print('Found!!')
await self.client.say('User is AFK')
@commands.command(pass_context = True)
async def afk(self, ctx):
server = ctx.message.server
channel = ctx.message.channel
author = ctx.message.author
date = datetime.date.today
embed = discord.Embed(
colour=discord.Colour.red()
)
afk_list.append(ctx.message.author.id)
embed.add_field(name='**User {} is currently AFK**'.format(author), value='Since ', inline=False)
await self.client.send_message(channel, embed=embed)
@commands.command()
async def afklist(self):
#await self.client.say('AFK ID list: ')
#for name in afk_list:
# print('List: {}'.format(name))
# await self.client.say(name)
print(afk_list)
def setup(client):
client.add_cog(Manage(client))
Спасибо! Я надеюсь, что кто-то может мне помочь.