Skip to content

Instantly share code, notes, and snippets.

@Boud811
Created June 16, 2019 01:49
Show Gist options
  • Save Boud811/afdbcd2f3bcfdf36967d091d79d8b8a7 to your computer and use it in GitHub Desktop.
Save Boud811/afdbcd2f3bcfdf36967d091d79d8b8a7 to your computer and use it in GitHub Desktop.
KSU Bot
import telebot
import time
import pyarabic.araby as araby
import pyarabic.number as number
token_bot = 'TOKEN'
bot = telebot.TeleBot(token_bot)
dictreplies = {
"Cutie":"@Boud241",
}
def kick_member(message):
if bot.get_chat_member(message.chat.id, bot.get_me().id).status == "administrator":
if bot.get_chat_member(message.chat.id, message.from_user.id).status == "member":
bot.reply_to(message, u"ستُطرد من القروب")
time.sleep(2)
bot.kick_chat_member(message.chat.id,message.from_user.id)
bot.unban_chat_member(message.chat.id, message.from_user.id)
else:
bot.reply_to(message, u"عيب أطرد المدير")
else:
bot.reply_to(message, u"أود أن أطردك، لكن ينبغي أن أكون مديرًا حتى أطردك")
@bot.message_handler(func=lambda m: True, content_types=['new_chat_members'])
def on_user_joins(message):
bot.reply_to(message,u"أهلًا، قروب جامعة الملك سعود وليست جامعة الملك سعود للعلوم الصحية (والله مو الحرس)\nبالغالب اللي تبحث عنه موجود في المثبّتة\n\nإذا تبي قروب الحرس هنا:\n\n @KSAUHSbatch18")
@bot.message_handler(func=lambda msg: msg.text ==u"اطردني" )
def kick_me(message):
kick_member(message)
@bot.message_handler(func=lambda msg: msg.text in dictreplies)
def reply_by_pre_msg(message):
reply = dictreplies.get(message.text)
bot.reply_to(message,reply)
@bot.message_handler(func=lambda msg: msg.text ==u"الاختصارات")
def shortcuts(message):
s =""
for key in dictreplies:
s += key + ".\n"
bot.reply_to(message, s)
while True:
try:
bot.polling()
except:
print("erorr")
time.sleep(15)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment