Beispiel #1
0
def help(bot, update):
	response = ''
	if admin.isadmin(id(update)):
		response = text.admin_help_text()
	else:
		response = text.help_text()
	bot.send_message(chat_id=chatid(update), text=response)
Beispiel #2
0
def unwarn(bot, update):
	if admin.isadmin(id(update)):
		warnmodule.unwarn(update.message.reply_to_message.from_user.id)
		status = warnmodule.get_status(update.message.reply_to_message.from_user.id)
		bot.send_message(chatid(update), 'user unwarned. user has now: {0}/4 warns'.format(status))
	else:
		bot.send_message(chat_id=chatid(update), text='you have to be admin to perform this command')
Beispiel #3
0
def unban(bot, update):

	messagereplied = ''
	try:
		messagereplied = update.message.reply_to_message.from_user.id 
	except:
		bot.send_message(chat_id=chatid(update), text='please reply to the user you want to unban')
		return
	if admin.isadmin(id(update)):
		bot.unban_chat_member(chat_id=chatid(update), user_id=messagereplied)
		bot.send_message(chatid(update), text='user unbanned')
	else:
		bot.send_message(chat_id=chatid(update), text=text.permission_denied(update.message.from_user.username))
Beispiel #4
0
def kick(bot, update, warn=False):
	if update.message.from_user.username.endswith('bot'):
		bot.send_message(chat_id=chatid(update), text='bots are not bannable by bots')
		return
	try:
		messagereplied = update.message.reply_to_message.from_user.id 
	except:
		bot.send_message(chat_id=chatid(update), text='please reply to the user you want to kick')
		return
	if admin.isadmin(id(update)):
		print('kick: @'+update.message.reply_to_message.from_user.username)
		bot.kick_chat_member(chat_id=chatid(update), user_id=messagereplied)
		unban(bot, update)
		if warn is False:
			bot.send_message(chat_id=chatid(update), text='kick succeded')
	else:
		bot.send_message(chat_id=chatid(update), text=text.permission_denied(update.message.from_user.username))
Beispiel #5
0
def ban(bot, update):
	if update.message.from_user.username.endswith('bot'):
		bot.send_message(chat_id=chatid(update), text='bots are not bannable by bots')
		return

	messagereplied = ''
	try:
		messagereplied = update.message.reply_to_message.from_user.id 
	except:
		bot.send_message(chat_id=chatid(update), text='please reply to the user you want to ban')
		return
	if admin.isadmin(id(update)):
		print('banned: @'+update.message.reply_to_message.from_user.username)
		bot.kick_chat_member(chatid(update), messagereplied, timeout=365*60*20*50)
		bot.send_message(chatid(update), text='ban succeded')
	else:
		bot.send_message(chat_id=chatid(update), text=text.permission_denied(update.message.from_user.username))
Beispiel #6
0
def warn(bot, update):
	try:
		messagereplied = update.message.reply_to_message.from_user.id 
	except:
		bot.send_message(chat_id=chatid(update), text='please reply to the user you want to kick')
		return
	if update.message.from_user.username.endswith('bot'):
		bot.send_message(chat_id=chatid(update), text='bots are not bannable by bots')
		return
	if admin.isadmin(id(update)):
		warning = warnmodule.warn(update.message.reply_to_message.from_user.id)
		status = warnmodule.get_status(update.message.reply_to_message.from_user.id)
		if status > 3:
			bot.send_message(chatid(update), 'User has been warned more than three times, beggining kick progress.')
			kick(bot, update)
			warn.unwarn(update.message.reply_to_message.from_user.id)
		else:
			bot.send_message(chatid(update), 'warned successfully. User has now: {0} out of 4 warns.'.format(status))
	else:
		bot.send_message(chat_id=chatid(update), text='you have to be admin to perform this command')
Beispiel #7
0
def removeadmin(bot, update):
	if admin.isadmin(id(update)):
		admin.removeadmin(update.message.reply_to_message.from_user.id)
		bot.send_message(chatid(update), text='admin removed')
Beispiel #8
0
def addadmin(bot, update):
	if admin.isadmin(id(update)):
		admin.newadmin(update.message.reply_to_message.from_user.id)
		bot.send_message(chatid(update), text='admin added')
	else:
		bot.send_message(chat_id=chatid(update), text=text.permission_denied(update.message.from_user.username))