-
Notifications
You must be signed in to change notification settings - Fork 13
/
bot.py
38 lines (28 loc) · 1.03 KB
/
bot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#Clear! by Da532.
#---CONFIG---
token = "TOKEN_HERE" # https://www.youtube.com/watch?v=tI1lzqzLQCs
prefix = "!" # This defines the selfbot prefix. You can customize it however you like, but you should probably keep it tiny.
#--- BOT ---
import discord
from discord.ext import commands
print("[Info] Logging into Discord")
bot = commands.Bot(command_prefix=prefix, self_bot=True)
bot.remove_command("help")
@bot.event
async def on_ready():
print("\n\n[Welcome] Ready! I await your command..")
print(f"[Welcome] Name: {bot.user.name}")
print(f"[Welcome] ID: {bot.user.id}\n\n")
@bot.command()
async def clear(ctx, limit: int=None):
passed = 0
failed = 0
async for msg in ctx.message.channel.history(limit=limit):
if msg.author.id == bot.user.id:
try:
await msg.delete()
passed += 1
except:
failed += 1
print(f"[Complete] Removed {passed} messages with {failed} fails")
bot.run(token, bot=False)