Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import discord
- from discord.ext import commands
- intents = discord.Intents.all()
- bot = commands.Bot(intents=intents, command_prefix="*")
- TOKEN = ""
- class settings:
- muted = False
- name = ""
- @bot.event
- async def on_ready():
- name_bot = bot.user.name
- print(f"{'-'*45}\nDiscord Bot is online as {name_bot}\n{'-'*45}")
- @bot.command(name="mute")
- async def mute(ctx):
- if not "Admin" in str(ctx.author.roles):
- return
- settings.name = ctx.author.name
- print(f"All channels have been disabled by {ctx.author.name}")
- message = await ctx.channel.send(f"All channels have been disabled by {ctx.author.name}")
- settings.muted = True
- await message.delete(delay=3)
- await ctx.message.delete(delay=3)
- @bot.command(name="unmute")
- async def unmute(ctx):
- if not "Admin" in str(ctx.author.roles):
- return
- print(f"All channels have been unlocked by {ctx.author.name}")
- message = await ctx.channel.send(f"All channels were unlocked by {ctx.author.name}")
- settings.muted = False
- await message.delete(delay=3)
- await ctx.message.delete(delay=3)
- @bot.event
- async def on_message(message):
- await bot.process_commands(message)
- if "Admin" in str(message.author.roles) or message.author == bot.user:
- return
- elif settings.muted:
- await message.delete()
- nachricht = await message.channel.send(f"All channels have been locked by {settings.name}")
- await nachricht.delete(delay=3)
- bot.run(TOKEN)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement