Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- # -*- coding: utf-8 -*-
- # NOTE: I did not program this, Nor do i know the author.
- # This was pulled and revamped from Retard MessengerTheGods Github
- # I DO NOT CLAIM AUTHORSHIP OF THIS PROGRAM - Aex
- # Instructions: Install Python3.
- # run: pip install asyncio && pip install discord
- # Side Note: If you previously added Python2 to your path,
- # Change directories to C:\Users\<USERNAME>\AppData\Local\Programs\Python\
- # Run Program: python dban.py clear <AUTH_TOKEN>
- # Error Handle: Sometimes Pastebin is retarded, and decides to take the qoute mark away from line 20.
- # add a " to line 20.
- import os
- import sys
- import discord
- import asyncio
- import subprocess
- cmd_prefix = sys.argv[1]
- auth_token = sys.argv[2]
- def puts(string):
- sys.stdout.write(string + "\n")
- def run(cmd):
- subprocess.call(cmd, shell=True)
- client = discord.Client()
- @client.event
- async def on_ready():
- if (os.name == "nt"):
- run('cls')
- elif (os.name == "posix"):
- run('clear')
- puts('[D_DBAN] Logged in as: %s' % (client.user.name))
- puts('[D_DBAN] User Identification: %s' % (client.user.id))
- puts('[D_DBAN] Discord Version: %s' % (discord.__version__))
- puts('----------')
- puts('Connected to:')
- for server in client.servers:
- puts(server.name)
- # Define commands
- @client.event
- async def on_message(message):
- if message.author == client.user:
- commands = []
- z = 0
- for index, a in enumerate(message.content):
- if a == " ":
- commands.append(message.content[z:index])
- z = index+1
- commands.append(message.content[z:])
- # MASS DELETE OWN MESSAGES
- if commands[0] == cmd_prefix:
- if len(commands) == 1:
- async for msg in client.logs_from(message.channel,limit=9999):
- if msg.author == client.user:
- try:
- await client.delete_message(msg)
- except Exception as x:
- puts("[D_DBAN] A exception has occured. Passing Exception")
- pass
- elif len(commands) == 2:
- user_id = ''
- for channel in client.private_channels:
- if commands[1] in str(channel):
- if str(channel.type) == 'private':
- user_id = str(channel.id)
- async for msg in client.logs_from(discord.Object(id=user_id),limit=9999):
- if msg.author == client.user:
- try:
- await client.delete_message(msg)
- except Exception as x:
- puts("[D_DBAN] A exception has occured. Passing Exception")
- pass
- client.run(auth_token, bot=False)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement