Пишу бота Discord. Участок кода:
banMsg = ["Матерок", "Матерок1", "Матерок2", "Матерок3", "Матеро4"]
@Bot.event
async def on_message(msg):
for i in banMsg:
if i in msg.content:
await Bot.ban(user.msg.message.author)
# await Bot.delete_message(msg)
await Bot.process_commands(msg)
Когда пользователь введёт слово, которое есть в списке banMsg
- ничего не будет, только ошибка в cmd:
Ignoring exception in on_message Traceback (most recent call last):
File "C:\Users\Матвей\AppData\Local\Programs\Python\Python35\lib\site-packages\discord\client.py", line 307, in _run_event yield from getattr(self, event)(*args, **kwargs) File "BOT.py", line 17, in on_message await Bot.ban(user.msg.message.author) NameError: name 'user' is not defined
Что нужно ввести в
await Bot.ban(user.msg.message.author)
(7 строка кода), что бы бот нормально забанил участника?
Ignoring exception in on_message Traceback (most recent call last): File "C:\Users\Матвей\AppData\Local\Programs\Python\Python35\lib\site-packages\discord\client.py", line 307, in _run_event yield from getattr(self, event)(*args, **kwargs) File "BOT.py", line 17, in on_message await Bot.ban(user.msg.message.author) NameError: name 'user' is not defined