Я делал команду для выдачи мута... Код вроде написал правильно, но выдается ошибка:
Ignoring exception in command mute:
Ignoring exception in on_command_error
Traceback (most recent call last):
File "C:\Users\DELL\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 173, in on_command_error
traceback.print_exception(type(exception), exception, exception.__traceback__, file=sys.stderr)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python310\lib\traceback.py", line 119, in print_exception
te = TracebackException(type(value), value, tb, limit=limit, compact=True)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python310\lib\traceback.py", line 533, in __init__
cause = TracebackException(
File "C:\Users\DELL\AppData\Local\Programs\Python\Python310\lib\traceback.py", line 502, in __init__
self.stack = StackSummary.extract(
File "C:\Users\DELL\AppData\Local\Programs\Python\Python310\lib\traceback.py", line 383, in extract
f.line
File "C:\Users\DELL\AppData\Local\Programs\Python\Python310\lib\traceback.py", line 306, in line
self._line = linecache.getline(self.filename, self.lineno)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python310\lib\linecache.py", line 30, in getline
lines = getlines(filename, module_globals)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python310\lib\linecache.py", line 46, in getlines
return updatecache(filename, module_globals)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python310\lib\linecache.py", line 137, in updatecache
lines = fp.readlines()
File "C:\Users\DELL\AppData\Local\Programs\Python\Python310\lib\codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe4 in position 312: invalid continuation byte
Я пытался гуглить, искать в других поисковых системах, в ютубе и других площадках. В итоге нигде нет ответа, поэтому я решился обратиться на этот сайт за помощью.
Вот сам код:
# -*- coding: utf-8 -*-
import discord
from discord.ext import commands
PREFIX = "!"
moderRole = 918921192419786793
bot = commands.Bot(command_prefix = PREFIX, Self = False)
@bot.command(pass_context = True)
@commands.has_any_role(moderRole)
async def mute(ctx, member: discord.Member):
muteRole = discord.utils.get(ctx.message.guild.roles, name = "mute")
await member.add_roles(muteRole)
await ctx.send(embed = discord.Embed(description = {member.mention} + "is muted"))