Beispiel #1
0
	if message.sticker is not None:
		return 'u send a sticker'
	if message.photo is not None:
		return 'u send a photo'
	return message.text
def execute_command(bot_command):
	if bot_command.command == '/meme':
		memes = give_me_meme(bot_command.discription)
		for meme in memes:
			bot.sendPhotoMessage(meme,chat_id=message.from_.id)
	elif bot_command.command == '/do':
		bot.sendTextMessage(message= f'kaam krtwa reh din bhar',chat_id=message.from_.id)

update_id = -1
while True:
	updates = bot.getUpdates(offset=(update_id + 1))
	result = updates['result']
	if result:
		for item in result:
			update_id = item['update_id']
			if 'message' in item:
				message = Message(**item['message'],from_=item['message']['from'])
				if 'entities' in item['message']:
					if item['message']['entities'][0]['type'] == 'bot_command':
						bot_command = BotCommand(command=message.text[item['message']['entities'][0]['offset']:item['message']['entities'][0]['length']], discription=message.text[item['message']['entities'][0]['length']:])
						execute_command(bot_command)
					else:
						bot.sendTextMessage(message=send_reply(message),chat_id=message.from_.id)
				else:
					bot.sendTextMessage(message=send_reply(message),chat_id=message.from_.id)