Skip to content Skip to sidebar Skip to footer

How Do I Make A Proper "nuke" Command Discord.py

Okay i want to make a 'nuke' command that basically saves the old name, topic and permissions, deletes the channel and add it back with the same permissions, name and topic. How do

Solution 1:

The discord.py API defines the various properties and methods one may manipulate for a Discord Channel. Rather than hard-coding this, I would recommend using the clone() method, which, given a channel,

Clones this channel. This creates a channel with the same properties as this channel.

At that point, you may simply delete the old channel via delete().

Solution 2:

Here is the code that I use, hope it helps

@client.command()asyncdefnuke(ctx, channel: discord.TextChannel = None):
    if channel == None: 
        await ctx.send("You did not mention a channel!")
        return

    nuke_channel = discord.utils.get(ctx.guild.channels, name=channel.name)

    if nuke_channel isnotNone:
        new_channel = await nuke_channel.clone(reason="Has been Nuked!")
        await nuke_channel.delete()
        await new_channel.send("THIS CHANNEL HAS BEEN NUKED!")
        await ctx.send("Nuked the Channel sucessfully!")

    else:
        await ctx.send(f"No channel named {channel.name} was found!")

Solution 3:

In the command

@commands.has_permissions(administrator=True)
@client.command
async def nuke():

Solution 4:

just use mee6 and !delete [number of messages to be deleted]

Post a Comment for "How Do I Make A Proper "nuke" Command Discord.py"