mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-08 18:32:32 -05:00
[Mod] Prevent users from expelling themselves
This commit is contained in:
17
cogs/mod.py
17
cogs/mod.py
@@ -258,6 +258,12 @@ class Mod:
|
||||
"""Kicks user."""
|
||||
author = ctx.message.author
|
||||
server = author.server
|
||||
|
||||
if author == user:
|
||||
await self.bot.say("I cannot let you do that. Self-harm is "
|
||||
"bad \N{PENSIVE FACE}")
|
||||
return
|
||||
|
||||
try:
|
||||
await self.bot.kick(user)
|
||||
logger.info("{}({}) kicked {}({})".format(
|
||||
@@ -285,6 +291,11 @@ class Mod:
|
||||
author = ctx.message.author
|
||||
server = author.server
|
||||
|
||||
if author == user:
|
||||
await self.bot.say("I cannot let you do that. Self-harm is "
|
||||
"bad \N{PENSIVE FACE}")
|
||||
return
|
||||
|
||||
if days:
|
||||
if days.isdigit():
|
||||
days = int(days)
|
||||
@@ -330,6 +341,12 @@ class Mod:
|
||||
channel = ctx.message.channel
|
||||
can_ban = channel.permissions_for(server.me).ban_members
|
||||
author = ctx.message.author
|
||||
|
||||
if author == user:
|
||||
await self.bot.say("I cannot let you do that. Self-harm is "
|
||||
"bad \N{PENSIVE FACE}")
|
||||
return
|
||||
|
||||
try:
|
||||
invite = await self.bot.create_invite(server, max_age=3600*24)
|
||||
invite = "\nInvite: " + invite
|
||||
|
||||
Reference in New Issue
Block a user