Answer the question
In order to leave comments, you need to log in
set_permissions not working in discord.py?
I am writing a discord bot in python, but when I try to create the mute command, I get an error.
here is my code:
from discord.ext import commands
from discord.ext.commads import has_permissions, MissingPermissions
import discord
class Mute(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command()
@commands.has_perrmissions( mute_members = True)
async def mute(self, ctx, *, member: discord.Member, reason = None):
for i in ctx.guild.channels:
channel = self.client.get_channel(i.id)
await channel.set_permissions(member, reason = reason, send_messages = False, add_reactions = False, speak = False)
def setup(client):
client.add_cog(Mute(client))
Answer the question
In order to leave comments, you need to log in
1. Why did you import commands separately from discord.ext and didn’t use it anywhere, then you re-import decorators along the same path from commands.
2. You have a grammatical error, instead of "discrod.ext.commands" you wrote "discord.ext.commADS", respectively, and an error occurs
ModuleNotFoundError: No module named 'discord.ext.commads'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question