Skip to content

Commit d477e4c

Browse files
committed
Update features
- Add kick command - Add ddos, swat commands
1 parent 6bc0506 commit d477e4c

File tree

5 files changed

+79
-28
lines changed

5 files changed

+79
-28
lines changed

TODO

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
-=-=-= Commands =-=-=-=-
2-
Mute <mention or id> - GuildAdminCommands
3-
Unmute <mention or id> - GuildAdminCommands
2+
~~Mute <mention or id> - GuildAdminCommands~~
3+
~~Unmute <mention or id> - GuildAdminCommands~~
44
AddBotAdmin <mention or id> - BotAdminCommands
55
RemoveBotAdmin <mention or id> - BotAdminCommands
6-
Kick <mention or id> - GuildAdminCommands
6+
~~Kick <mention or id> - GuildAdminCommands~~
77
CreateRole <role name> - GuildAdminCommands
88
DeleteRole <role mention, id or name?> - GuildAdminCommands
99
BanServer <server id> - BotAdminCommands
1010
UnbanServer <server id> - BotAdminCommands
1111
BanUser <mention or id> - BotAdminCommands
1212
UnbanUser <mention or id> - BotAdminCommands
13-
13+
Strike <mention or id> [reason] - GuildAdminCommands
14+
Strikes <mention or id> - GuildAdminCommands
1415

1516
-=-=-= Other Ideas =-=-=-=-
1617
Add optional argument to ban command for soft or hard ban mode (soft doesnt delete message history from user, hard does)

cogs/GuildAdminCommands.py

Lines changed: 49 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def __init__(self, bot):
1414
@commands.command(name="ban")
1515
@commands.guild_only()
1616
@commands.has_permissions(ban_members=True)
17-
async def ban(self, ctx, member: discord.Member = None, reason: str = "No reason specified!", dmd=0):
17+
async def ban(self, ctx, member: discord.Member = None, reason: str = "No reason specified", dmd=0):
1818
if member is None or member == ctx.message.author:
1919
await ctx.send(f"You cannot ban yourself!")
2020
return
@@ -24,7 +24,8 @@ async def ban(self, ctx, member: discord.Member = None, reason: str = "No reason
2424
return
2525

2626
# TODO: log channel embed with reason (see: https://github.com/Puyodead1/Extron/blob/master/Discord/Commands/ban.js)
27-
embed = discord.Embed(title=f"Bye Bye **{member.name}** 🔨",
27+
embed = discord.Embed(title=None,
28+
description=f"Bye Bye **{member.name}** 🔨",
2829
color=discord.Color.green(),
2930
timestamp=datetime.utcnow())
3031
embed.set_image(url="https://thumbs.gfycat.com/ElderlyViciousFeline-size_restricted.gif")
@@ -34,7 +35,7 @@ async def ban(self, ctx, member: discord.Member = None, reason: str = "No reason
3435
await member.ban(reason=reason, delete_message_days=dmd)
3536
await ctx.send(content=None, embed=embed)
3637
except Forbidden as e:
37-
embed = discord.Embed(title=f"Missing `ban_members` permission!", description=f"Error: {e.text}",
38+
embed = discord.Embed(title=f"Missing permission!", description=f"Error: {e.text}",
3839
color=discord.Color.red(),
3940
timestamp=datetime.utcnow())
4041
embed.set_footer(text=ctx.author.name, icon_url=ctx.author.avatar_url)
@@ -53,15 +54,16 @@ async def ban(self, ctx, member: discord.Member = None, reason: str = "No reason
5354
@commands.command(name="unban")
5455
@commands.guild_only()
5556
@commands.has_permissions(ban_members=True)
56-
async def ban(self, ctx, user_id: str, reason="No reason specified!"):
57+
async def ban(self, ctx, user_id: str, reason="No reason specified"):
5758
try:
5859
member = await self.bot.fetch_user(user_id=user_id)
5960
try:
6061
await ctx.guild.unban(user=member, reason=reason)
61-
embed = discord.Embed(title=f"{member.name} has been unbanned!",
62-
description=f"Unban Reason: {reason}",
62+
embed = discord.Embed(title=None,
63+
description=f"{member.name} has been unbanned!",
6364
color=discord.Color.green(),
6465
timestamp=datetime.utcnow())
66+
embed.add_field(name=f"Unban Reason", value=reason)
6567
embed.set_thumbnail(
6668
url="https://icon-library.net/images/green-checkmark-icon/green-checkmark-icon-11.jpg")
6769
embed.set_footer(text=f"Unbanned by {ctx.author.name}", icon_url=ctx.author.avatar_url)
@@ -95,7 +97,7 @@ async def ban(self, ctx, user_id: str, reason="No reason specified!"):
9597
@commands.command(name="mute")
9698
@commands.guild_only()
9799
@commands.has_permissions(kick_members=True)
98-
async def mute(self, ctx, member: discord.Member, reason: str = "No reason specified!"):
100+
async def mute(self, ctx, member: discord.Member, reason: str = "No reason specified"):
99101
if member.bot:
100102
await ctx.send(f"{member.name} is a bot.")
101103
return
@@ -107,7 +109,11 @@ async def mute(self, ctx, member: discord.Member, reason: str = "No reason speci
107109
if muted_role:
108110
try:
109111
await member.add_roles(muted_role, reason=reason, atomic=False)
110-
await ctx.send(f"{member.name} was muted!")
112+
embed = discord.Embed(title=None, description=f"**{member.name}** was muted 🔇",
113+
color=discord.Color.green(), timestamp=datetime.utcnow())
114+
embed.set_author(name=self.bot.user.name, icon_url=self.bot.user.avatar_url)
115+
embed.set_footer(text=f"Muted by {ctx.author.name}", icon_url=ctx.author.avatar_url)
116+
await ctx.send(content=None, embed=embed)
111117
await member.send(
112118
f"You were muted by {ctx.message.author.name} in {ctx.guild.name} for {reason}")
113119
log_channel = [x for x in member.guild.channels if x.name == "logs"]
@@ -118,12 +124,13 @@ async def mute(self, ctx, member: discord.Member, reason: str = "No reason speci
118124
embed = discord.Embed(title=f"{member.name}#{member.discriminator} was muted!",
119125
description=None, color=discord.Color.red(),
120126
timestamp=datetime.utcnow())
127+
embed.set_author(name=self.bot.user.name, icon_url=self.bot.user.avatar_url)
121128
embed.add_field(name=f"Mute Reason", value=reason)
122129
embed.set_thumbnail(url=member.avatar_url)
123130
embed.set_footer(text=f"Muted by {ctx.author.name}", icon_url=ctx.author.avatar_url)
124131
await log_channel.send(content=None, embed=embed)
125132
except Forbidden as e:
126-
await ctx.send(f"[GuildAdminCommands] Missing `manage_roles` permission! Error: {e.text}")
133+
await ctx.send(f"[GuildAdminCommands] Missing permission! Error: {e.text}")
127134
except HTTPException as e:
128135
await ctx.send(f"[GuildAdminCommands] Failed to add role! Error: {e.text}")
129136
else:
@@ -141,7 +148,7 @@ async def mute(self, ctx, member: discord.Member, reason: str = "No reason speci
141148
print(f"Set permissions on channel {channel.name}")
142149
except Forbidden as e:
143150
# no permission to edit channel specific permissions
144-
await ctx.send(f"[GuildAdminCommands] Missing `administrator` permission! Error: {e.text}")
151+
await ctx.send(f"[GuildAdminCommands] Missing permission! Error: {e.text}")
145152
except NotFound as e:
146153
await ctx.send(
147154
f"[GuildAdminCommands] The role or member being edited is not part of the guild! Error: {e.text}")
@@ -154,7 +161,11 @@ async def mute(self, ctx, member: discord.Member, reason: str = "No reason speci
154161

155162
try:
156163
await member.add_roles(muted_role, reason=reason, atomic=False)
157-
await ctx.send(f"{member.name} was muted!")
164+
embed = discord.Embed(title=None, description=f"**{member.name}** was muted 🔇",
165+
color=discord.Color.green(), timestamp=datetime.utcnow())
166+
embed.set_author(name=self.bot.user.name, icon_url=self.bot.user.avatar_url)
167+
embed.set_footer(text=f"Muted by {ctx.author.name}", icon_url=ctx.author.avatar_url)
168+
await ctx.send(content=None, embed=embed)
158169
await member.send(
159170
f"You were muted by {ctx.message.author.name} in {ctx.guild.name} for {reason}")
160171
log_channel = [x for x in member.guild.channels if x.name == "logs"]
@@ -166,16 +177,17 @@ async def mute(self, ctx, member: discord.Member, reason: str = "No reason speci
166177
description=None, color=discord.Color.red(),
167178
timestamp=datetime.utcnow())
168179
embed.add_field(name=f"Mute Reason", value=reason)
180+
embed.set_author(name=self.bot.user.name, icon_url=self.bot.user.avatar_url)
169181
embed.set_thumbnail(url=member.avatar_url)
170182
embed.set_footer(text=f"Muted by {ctx.author.name}", icon_url=ctx.author.avatar_url)
171183
await log_channel.send(content=None, embed=embed)
172184
except Forbidden as e:
173-
await ctx.send(f"[GuildAdminCommands] Missing `manage_roles` permission! Error: {e.text}")
185+
await ctx.send(f"[GuildAdminCommands] Missing permission! Error: {e.text}")
174186
except HTTPException as e:
175187
await ctx.send(f"[GuildAdminCommands] Failed to add role! Error: {e.text}")
176188
except Forbidden as e:
177189
# no permission to create the role
178-
await ctx.send(f"[GuildAdminCommands] Cannot create muted role, Missing `manage_roles` "
190+
await ctx.send(f"[GuildAdminCommands] Cannot create muted role, Missing "
179191
f"permission! Error: {e.text}")
180192
except HTTPException as e:
181193
# Creating role failed
@@ -190,7 +202,7 @@ async def mute(self, ctx, member: discord.Member, reason: str = "No reason speci
190202
@commands.command(name="unmute")
191203
@commands.guild_only()
192204
@commands.has_permissions(administrator=True)
193-
async def unmute(self, ctx, member: discord.Member, reason: str = "No reason specified!"):
205+
async def unmute(self, ctx, member: discord.Member, reason: str = "No reason specified"):
194206
if member.bot:
195207
await ctx.send(f"{member.name} is a bot.")
196208
return
@@ -201,7 +213,11 @@ async def unmute(self, ctx, member: discord.Member, reason: str = "No reason spe
201213
# check length of the list, if 0 no muted role, if == 0 there is one
202214
try:
203215
await member.remove_roles(muted_role, reason=reason)
204-
await ctx.send(f"{member.name} was unmuted!")
216+
embed = discord.Embed(title=None, description=f"**{member.name}** was unmuted 🔊",
217+
color=discord.Color.green(), timestamp=datetime.utcnow())
218+
embed.set_author(name=self.bot.user.name, icon_url=self.bot.user.avatar_url)
219+
embed.set_footer(text=f"Unmuted by {ctx.author.name}", icon_url=ctx.author.avatar_url)
220+
await ctx.send(content=None, embed=embed)
205221
await member.send(f"You were unmuted by {ctx.message.author.name} in {ctx.guild.name}")
206222
log_channel = [x for x in member.guild.channels if x.name == "logs"]
207223
log_channel = log_channel[0] if len(
@@ -212,18 +228,35 @@ async def unmute(self, ctx, member: discord.Member, reason: str = "No reason spe
212228
description=None, color=discord.Color.green(),
213229
timestamp=datetime.utcnow())
214230
embed.add_field(name=f"Unmute Reason", value=reason)
231+
embed.set_author(name=self.bot.user.name, icon_url=self.bot.user.avatar_url)
215232
embed.set_thumbnail(url=member.avatar_url)
216233
embed.set_footer(text=f"Unmuted by {ctx.author.name}", icon_url=ctx.author.avatar_url)
217234
await log_channel.send(content=None, embed=embed)
218235
except Forbidden as e:
219236
# missing permission to remove roles
220-
await ctx.send(f"[GuildAdminCommands] Missing `manage_roles` permission! Error: {e.text}")
237+
await ctx.send(f"[GuildAdminCommands] Missing permission! Error: {e.text}")
221238
except HTTPException as e:
222239
await ctx.send(f"[GuildAdminCommands] Failed to remove roles! Error: {e.text}")
223240
except HTTPException as e:
224241
# Retrieving roles failed
225242
await ctx.send(f"[GuildAdminCommands] Retrieving roles failed! Error: {e.text}")
226243

227244

245+
@commands.command(name="kick")
246+
@commands.guild_only()
247+
# TODO: reason?
248+
async def kick(self, ctx, member: discord.Member):
249+
try:
250+
await member.kick()
251+
embed = discord.Embed(title=None, description=f"**{member.name}** was kicked 👋", color=discord.Color.green(), timestamp=datetime.utcnow())
252+
embed.set_author(name=self.bot.user.name, icon_url=self.bot.user.avatar_url)
253+
embed.set_footer(text=f"Kicked by {ctx.author.name}", icon_url=ctx.author.avatar_url)
254+
await ctx.send(content=None, embed=embed)
255+
except Forbidden as e:
256+
await ctx.send(f"[GuildAdminCommands] Missing permission! Error: {e.text}")
257+
except HTTPException as e:
258+
await ctx.send(f"[GuildAdminCommands] Failed to kick user {member.name}! Error: {e.text}")
259+
260+
228261
def setup(bot):
229262
bot.add_cog(GuildAdminCommandsCog(bot))

cogs/GuildEvents.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ async def on_member_join(self, member):
2222
embed = discord.Embed(title="User joined the server!", description=None, color=discord.Color.green(), timestamp=datetime.utcnow())
2323
embed.add_field(name=f"Username", value=f"{member.name}#{member.discriminator}", inline=False)
2424
embed.add_field(name=f"User ID", value=member.id, inline=False)
25+
embed.set_author(name=self.bot.user.name, icon_url=self.bot.user.avatar_url)
2526
embed.add_field(name="Account created", value=f"{created_date}", inline=False)
2627
embed.set_thumbnail(url=member.avatar_url)
2728
embed.set_footer(text=self.bot.user.name, icon_url=self.bot.user.avatar_url)
@@ -53,6 +54,7 @@ async def on_member_remove(self, member):
5354
embed.add_field(name=f"Username", value=f"{member.name}#{member.discriminator}", inline=False)
5455
embed.add_field(name=f"User ID", value=member.id, inline=False)
5556
embed.add_field(name="Account created", value=f"{created_date}", inline=False)
57+
embed.set_author(name=self.bot.user.name, icon_url=self.bot.user.avatar_url)
5658
embed.add_field(name="Joined", value=f"{joined_date}", inline=False)
5759
embed.set_thumbnail(url=member.avatar_url)
5860
embed.set_footer(text=self.bot.user.name, icon_url=self.bot.user.avatar_url)
@@ -72,6 +74,7 @@ async def on_member_ban(self, guild, member):
7274
embed.add_field(name=f"Username", value=f"{member.name}#{member.discriminator}", inline=False)
7375
embed.add_field(name="User ID", value=member.id, inline=False)
7476
embed.add_field(name=f"Ban Reason", value=ban_reason.reason)
77+
embed.set_author(name=self.bot.user.name, icon_url=self.bot.user.avatar_url)
7578
embed.set_thumbnail(url=member.avatar_url)
7679
embed.set_footer(text=member.name, icon_url=member.avatar_url)
7780
await log_channel.send(content=None, embed=embed)
@@ -87,6 +90,7 @@ async def on_member_unban(self, guild, member):
8790
timestamp=datetime.utcnow())
8891
embed.add_field(name=f"Username", value=f"{member.name}#{member.discriminator}", inline=False)
8992
embed.add_field(name="User ID", value=member.id, inline=False)
93+
embed.set_author(name=self.bot.user.name, icon_url=self.bot.user.avatar_url)
9094
embed.set_thumbnail(url=member.avatar_url)
9195
embed.set_footer(text=member.name, icon_url=member.avatar_url)
9296
await log_channel.send(content=None, embed=embed)

cogs/MiscCommands.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ async def ping(self, ctx):
2424
embed.add_field(name="🤖 Bot Latency:", value=f"{int(ping)}ms", inline=False)
2525
# adds a footer to the embed with the bot name and avatar
2626
embed.set_footer(text=ctx.author.name, icon_url=ctx.author.avatar_url)
27+
embed.set_author(name=self.bot.user.name, icon_url=self.bot.user.avatar_url)
2728
# edits the previous message sent with the new embed
2829
await message.edit(content=None, embed=embed)
2930

@@ -53,7 +54,7 @@ async def status(self, ctx):
5354
embed.add_field(name="Python Version:", value=f"{sys.version.split(' ')[0]}", inline=False)
5455
embed.add_field(name="Discord.py Version:", value=f"{discord.__version__}", inline=False)
5556
embed.add_field(name="Created by:", value="Riley and Skyler", inline=False)
56-
57+
embed.set_author(name=self.bot.user.name, icon_url=self.bot.user.avatar_url)
5758
embed.set_footer(text=ctx.author.name, icon_url=ctx.author.avatar_url)
5859
await ctx.send(content=None, embed=embed)
5960

@@ -68,6 +69,20 @@ async def avatar(self, ctx, member: discord.Member = None):
6869
embed.set_image(url=member.avatar_url)
6970
await ctx.send(content=None, embed=embed)
7071

72+
@commands.command(name="ddos")
73+
@commands.guild_only()
74+
async def ddos(self, ctx, member: discord.Member):
75+
await ctx.send(f"Initiating DDoS attack on {member.name}, please wait...")
76+
time.sleep(1000)
77+
await ctx.send("Malicious UDP packets were sent to their IP address, they should be offline now. :)")
78+
79+
@commands.command(name="swat")
80+
@commands.guild_only()
81+
async def swat(self, ctx, member: discord.Member):
82+
await ctx.send(f"Initiating SWAT procedures on {member.name}, please wait...")
83+
time.sleep(1000)
84+
await ctx.send("Your local police department has been notified that you have shot your Dad & now have your mother hostage in your home, along with a can of gas with you to burn your house down. Enjoy the shitshow, motherfucker.")
85+
7186

7287
def setup(bot):
7388
bot.add_cog(MiscCommandsCog(bot))

cogs/XCommands.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,17 @@ async def xban(self, ctx, member: discord.Member, reason: str = None):
1515
color=discord.Color.green(),
1616
timestamp=datetime.utcnow())
1717
embed.set_image(url="https://thumbs.gfycat.com/ElderlyViciousFeline-size_restricted.gif")
18+
embed.set_author(name=self.bot.user.name, icon_url=self.bot.user.avatar_url)
1819
embed.set_footer(text=f"Banned by {ctx.author.name}", icon_url=ctx.author.avatar_url)
1920
await ctx.send(content=None, embed=embed)
2021

2122
@commands.command(name="xmute")
2223
@commands.guild_only()
2324
async def xmute(self, ctx, member: discord.Member, reason: str = None):
24-
embed = discord.Embed(title=f"{member.name} has been muted!",
25-
description=f"Muted for: {reason}" if reason else None,
26-
color=discord.Color.green(),
27-
timestamp=datetime.utcnow())
28-
embed.set_image(url="https://thumbs.gfycat.com/ElderlyViciousFeline-size_restricted.gif")
29-
embed.set_footer(text=f"Muted by {ctx.author.name}", icon_url=ctx.author.avatar_url)
30-
await ctx.send(content=None, embed=embed)
25+
if reason:
26+
await ctx.send(content=f"{member.name} was muted by {ctx.author.name} for {reason}")
27+
else:
28+
await ctx.send(content=f"{member.name} was muted by {ctx.author.name}")
3129

3230

3331
def setup(bot):

0 commit comments

Comments
 (0)