Skip to content

Commit

Permalink
Update bans.py
Browse files Browse the repository at this point in the history
  • Loading branch information
madboy482 authored Feb 25, 2021
1 parent ea05a95 commit ee1509d
Showing 1 changed file with 34 additions and 34 deletions.
68 changes: 34 additions & 34 deletions SaitamaRobot/modules/bans.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,49 +33,49 @@ def ban(update: Update, context: CallbackContext) -> str:
user_id, reason = extract_user_and_text(message, args)

if not user_id:
message.reply_text("I doubt that's a user.")
message.reply_text("I doubt that's a user...πŸ€”πŸ€”")
return log_message

try:
member = chat.get_member(user_id)
except BadRequest as excp:
if excp.message == "User not found":
message.reply_text("Can't seem to find this person.")
message.reply_text("Can't seem to find this person...πŸ€”πŸ€”")
return log_message
else:
raise

if user_id == bot.id:
message.reply_text("Oh yeah, ban myself, noob!")
message.reply_text("Oh yeah, ban myself, Noob Nibba!!")
return log_message

if is_user_ban_protected(chat, user_id, member) and user not in DEV_USERS:
if user_id == OWNER_ID:
message.reply_text(
"Trying to put me against a God level disaster huh?")
"Trying to put me against a God level disaster, huh???")
return log_message
elif user_id in DEV_USERS:
message.reply_text("I can't act against our own.")
message.reply_text("I can't act against our own!.!")
return log_message
elif user_id in DRAGONS:
message.reply_text(
"Fighting this Dragon here will put civilian lives at risk.")
"Fighting this Dragon here will put civilian lives at risk!.!")
return log_message
elif user_id in DEMONS:
message.reply_text(
"Bring an order from Heroes association to fight a Demon disaster."
"Bring an order from Heroes association to fight a Demon disaster!.!"
)
return log_message
elif user_id in TIGERS:
message.reply_text(
"Bring an order from Heroes association to fight a Tiger disaster."
"Bring an order from Heroes association to fight a Tiger disaster!.!"
)
return log_message
elif user_id in WOLVES:
message.reply_text("Wolf abilities make them ban immune!")
message.reply_text("Wolf abilities make them Ban immune!!")
return log_message
else:
message.reply_text("This user has immunity and cannot be banned.")
message.reply_text("This user has immunity and cannot be banned!!")
return log_message

log = (
Expand All @@ -100,7 +100,7 @@ def ban(update: Update, context: CallbackContext) -> str:
return log

except BadRequest as excp:
if excp.message == "Reply message not found":
if excp.message == "Reply message not found...πŸ€”":
# Do not reply
message.reply_text('Banned!', quote=False)
return log
Expand Down Expand Up @@ -129,20 +129,20 @@ def temp_ban(update: Update, context: CallbackContext) -> str:
user_id, reason = extract_user_and_text(message, args)

if not user_id:
message.reply_text("I doubt that's a user.")
message.reply_text("I doubt that's a user...πŸ€”πŸ€”")
return log_message

try:
member = chat.get_member(user_id)
except BadRequest as excp:
if excp.message == "User not found":
message.reply_text("I can't seem to find this user.")
message.reply_text("I can't seem to find this user...πŸ€”")
return log_message
else:
raise

if user_id == bot.id:
message.reply_text("I'm not gonna BAN myself, are you crazy?")
message.reply_text("I'm not gonna BAN myself, are you crazy??πŸ˜‘πŸ˜‘")
return log_message

if is_user_ban_protected(chat, user_id, member):
Expand Down Expand Up @@ -180,22 +180,22 @@ def temp_ban(update: Update, context: CallbackContext) -> str:
# bot.send_sticker(chat.id, BAN_STICKER) # banhammer marie sticker
bot.sendMessage(
chat.id,
f"Banned! User {mention_html(member.user.id, html.escape(member.user.first_name))} "
f"Yeah, Banned! User {mention_html(member.user.id, html.escape(member.user.first_name))}"
f"will be banned for {time_val}.",
parse_mode=ParseMode.HTML)
return log

except BadRequest as excp:
if excp.message == "Reply message not found":
if excp.message == "Reply message not found...":
# Do not reply
message.reply_text(
f"Banned! User will be banned for {time_val}.", quote=False)
f"<b>Yeah, Banned {mention_html(member.user.id, html.escape(member.user.first_name))!\nUser will be banned for {time_val}.", quote=False)
return log
else:
LOGGER.warning(update)
LOGGER.exception("ERROR banning user %s in chat %s (%s) due to %s",
user_id, chat.title, chat.id, excp.message)
message.reply_text("Well damn, I can't ban that user.")
message.reply_text("Well demn, I can't ban that user!.!")

return log_message

Expand Down Expand Up @@ -223,25 +223,25 @@ def kick(update: Update, context: CallbackContext) -> str:
member = chat.get_member(user_id)
except BadRequest as excp:
if excp.message == "User not found":
message.reply_text("I can't seem to find this user.")
message.reply_text("I can't seem to find this user...πŸ€”πŸ€”")
return log_message
else:
raise

if user_id == bot.id:
message.reply_text("Yeahhh I'm not gonna do that.")
message.reply_text("Yeahhh I'm not gonna do that!.!")
return log_message

if is_user_ban_protected(chat, user_id):
message.reply_text("I really wish I could kick this user....")
message.reply_text("I really wish I could kick this user....πŸ€”πŸ€”")
return log_message

res = chat.unban_member(user_id) # unban on current user = kick
if res:
# bot.send_sticker(chat.id, BAN_STICKER) # banhammer marie sticker
bot.sendMessage(
chat.id,
f"Yeah, Kicked! {mention_html(member.user.id, html.escape(member.user.first_name))}.",
f"<b>Yeah, Kicked!</b> {mention_html(member.user.id, html.escape(member.user.first_name))}.",
parse_mode=ParseMode.HTML)
log = (
f"<b>{html.escape(chat.title)}:</b>\n"
Expand All @@ -255,7 +255,7 @@ def kick(update: Update, context: CallbackContext) -> str:
return log

else:
message.reply_text("Well damn, I can't kick that user.")
message.reply_text("Well demn, I can't kick that user!.!")

return log_message

Expand All @@ -273,7 +273,7 @@ def kickme(update: Update, context: CallbackContext):
res = update.effective_chat.unban_member(
user_id) # unban on current user = kick
if res:
update.effective_message.reply_text("*kicks you out of the group*")
update.effective_message.reply_text("*Kicks you out of the group*")
else:
update.effective_message.reply_text("Huh? I can't :/")

Expand All @@ -294,28 +294,28 @@ def unban(update: Update, context: CallbackContext) -> str:
user_id, reason = extract_user_and_text(message, args)

if not user_id:
message.reply_text("I doubt that's a user.")
message.reply_text("I doubt that's a user...πŸ€”πŸ€”")
return log_message

try:
member = chat.get_member(user_id)
except BadRequest as excp:
if excp.message == "User not found":
message.reply_text("I can't seem to find this user.")
if excp.message == "User not found...πŸ€”πŸ€”":
message.reply_text("I can't seem to find this user...πŸ€”πŸ€”")
return log_message
else:
raise

if user_id == bot.id:
message.reply_text("How would I unban myself if I wasn't here...?")
message.reply_text("How would I unban myself if I wasn't here...?πŸ˜‘πŸ˜‘")
return log_message

if is_user_in_chat(chat, user_id):
message.reply_text("Isn't this person already here??")
message.reply_text("Isn't this person already here??πŸ™„πŸ™„")
return log_message

chat.unban_member(user_id)
message.reply_text("Yep, this user can join!")
message.reply_text("Yep, this user can join again!!πŸ˜ͺπŸ˜ͺ")

log = (
f"<b>{html.escape(chat.title)}:</b>\n"
Expand Down Expand Up @@ -353,17 +353,17 @@ def selfunban(context: CallbackContext, update: Update) -> str:
member = chat.get_member(user.id)
except BadRequest as excp:
if excp.message == "User not found":
message.reply_text("I can't seem to find this user.")
message.reply_text("I can't seem to find this user...πŸ€”πŸ€”")
return
else:
raise

if is_user_in_chat(chat, user.id):
message.reply_text("Aren't you already in the chat??")
message.reply_text("Aren't you already in the chat??πŸ™„πŸ™„")
return

chat.unban_member(user.id)
message.reply_text("Yep, I have unbanned you.")
message.reply_text("Yep, I have unbanned you.πŸ˜ͺπŸ˜ͺ")

log = (
f"<b>{html.escape(chat.title)}:</b>\n"
Expand All @@ -375,7 +375,7 @@ def selfunban(context: CallbackContext, update: Update) -> str:


__help__ = """
β€’ `/kickme`*:* kicks the user who issued the command
β€’ `/kickme`*:* Kicks the user who issued the command
*Admins only:*
β€’ `/ban <userhandle>`*:* bans a user. (via handle, or reply)
Expand Down

0 comments on commit ee1509d

Please sign in to comment.