I tried making a command to purge messages with a slash command. However, I get a AttributeError: type object 'MISSING' has no attribute 'purge' error. Can anyone help me please?
Here's the code
# Les imports
import interactions
import os
import asyncio as a
from discord.ext import commands
# Le bot
slash = interactions.Client(token=token)
# Début du code
@slash.command(
name="delete",
description="Supprime les X derniers messages",
options = [
interactions.Option(
name="number_of_messages",
description="Combien de messages à delete ?",
type=interactions.OptionType.STRING,
required=True,
),
],
)
async def delete(ctx: interactions.CommandContext, number_of_messages: str):
await ctx.channel.purge(int(number_of_messages))
slash.start()
You don't need
discord-interactionlibrary anymore indiscord.py v2. There already library to do it. So you can just usingdiscord.py.Make sure the one who want to use this purge command has
manage_messagesperms