def function_start(message): bot.send_message(message.chat.id, f"<b>Welcome {message.from_user.first_name}</b> ༼ つ ◕_◕ ༽つ\n" + f"I'm <i>{bot.get_me().first_name}</i> and I serve as cloud server\n" + f"assistant helper for my Genemator master!\n" + "\n" + f"<b>For further information or help, type</b> /help\n", parse_mode='HTML') pass
def function_error(message): bot.send_message(message.chat.id, f"<b>Dear {message.from_user.first_name}</b>.\n" + f"I could not understand what command you insert.\n" + f"Currently, I'm underdevelopment and occasion errors might occur!\n" + "\n" + f"<b>Please, for further information or help, type</b> /help\n", parse_mode='HTML') pass
def __message(message): url_pattern = r'''(?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|( \([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’])) ''' censored = cleaner(profanity.censor(message.text)) result = re.sub(url_pattern, '', censored) content = \ f"#{message.message_id}: <i>" + result + "</i>" bot.send_message(CONFESSION, content, parse_mode='HTML') pass
def __start(message): text = \ "<b>Ladies and Gentlemen, welcome to my confession!</b> \n" \ f"<i>Dear, {message.from_user.first_name}. Feel free to start " \ "writing to me and I'll deliver your messages to our elegant confession...</i> \n" \ "\n" \ "<code>If you're having some trouble with me, just type </code>/help<code> " \ "and I'll show you instructions!</code>" bot.send_message(message.from_user.id, text, parse_mode='HTML') pass
def __help(message): instructions = \ "<b>This is the list of available commands:</b> \n" \ "/help - <code>Show this mesage</code> \n" \ "/echo - <code>Announce an important message</code> \n" \ "/prod - <code>Production funds of this project</code> \n" \ "/source - <code>Source code of this project</code> \n" \ "\n" \ "<i>In order to send messages, start writing to me as you do in pms with people. " \ "Send me videos, gifs, sticker and photos and I'll deliver them to our confession!</i>" bot.send_message(message.from_user.id, instructions, parse_mode='HTML') pass
def command_help(user): chat_id = user.chat.id help_text = "The following commands are available: \n" common_commands = { # command description used in the "help" command 'start': 'Get used to the bot', 'help': 'Gives you information about the available commands', 'gov': 'Login as governor, requires a password!', 'admin': ' Login as admin, requires a password!', } for key in common_commands: # generate help text out of the commands dictionary defined at the top help_text += "/" + key + ": " help_text += common_commands[key] + "\n" bot.send_message(chat_id, help_text) # send the generated help page
def __echo(message): sender = message.from_user.first_name _message = message.text[6:] content = \ f"<b>ATTENTION!</b> \n" \ f"<i>{_message}</i>" pm = bot.send_message(CONFESSION, content, parse_mode='HTML') bot.pin_chat_message(CONFESSION, pm.message_id) pass
def __help(message): _from = message.from_user.id buttons = [ types.InlineKeyboardButton(text="Website", url="https://deno.land/"), types.InlineKeyboardButton(text="Documentation", url="https://doc.deno.land/"), types.InlineKeyboardButton(text="Start searching packages", switch_inline_query_current_chat="") ] keyboard = types.InlineKeyboardMarkup(row_width=len(buttons)) for button in buttons: keyboard.add(button) helper = \ f"<b>This is the available command list:</b> \n" \ f"/help - to show this menu \n" \ f"\n" \ f"<i>In order to use package search engine, press 'start searching packages' button below...</i>" bot.send_message(_from, helper, reply_markup=keyboard, parse_mode="HTML")
def start(user): chat_id = user.chat.id bot.send_message(chat_id, f"Welcome to {game['name']}", reply_markup=types.ReplyKeyboardRemove(selective=False)) if User().get_by_chat_id( chat_id=chat_id ) is None: # if user hasn't used the "/start" command yet: bot.send_message(chat_id, "Hello, stranger, let me scan you...") User().new(chat_id=chat_id) command_help(user) # show the new user the help page bot.send_message(chat_id, "Scanning complete, I know you now", reply_markup=menu_builder.common_user_menu()) else: bot.send_message( chat_id, "I already know you, no need for me to scan you again!", reply_markup=menu_builder.common_user_menu())
def function_restart(message): bot.send_message( message.chat.id, f"<b>ATTENTION!!! </b> ༼ つ ◕_◕ ༽つ\n" + f"{message.from_user.first_name}, I'm restarting myself!\n" + f"Get ready...\n" + "\n" + f"<b>For further information or help, type</b> /help\n", parse_mode='HTML') sleep(1) bot.send_message(message.chat.id, '<b>3...</b>', parse_mode='HTML') sleep(1) bot.send_message(message.chat.id, '<b>2...</b>', parse_mode='HTML') sleep(1) bot.send_message(message.chat.id, '<b>1...</b>', parse_mode='HTML') os.execl(sys.executable, sys.executable, *sys.argv) pass
def function_stop(message): bot.send_message(message.chat.id, f"<b>ATTENTION!!! </b> ༼ つ ◕_◕ ༽つ\n" + f"{message.from_user.first_name}, I'm terminating myself!\n" + f"Get ready...\n" + "\n" + f"<b>For further information or help, type</b> /help\n", parse_mode='HTML') sleep(1) bot.send_message(message.chat.id, '<b>3...</b>', parse_mode='HTML') sleep(1) bot.send_message(message.chat.id, '<b>2...</b>', parse_mode='HTML') sleep(1) bot.send_message(message.chat.id, '<b>1...</b>', parse_mode='HTML') exit(1) exit(1) pass
def function_help(message): bot.send_message(message.chat.id, help_message, parse_mode='HTML')
def __prod(message): source = "<b>[🤵] Our very own projects that inspired and supported this one!</b>" bot.send_message(message.from_user.id, source, parse_mode='HTML', reply_markup=_keyboard())
def __source(message): source = "<b>[🤵] If you are experienced developer, contribute with me!</b>" bot.send_message(message.from_user.id, source, parse_mode='HTML', reply_markup=_keyboard())
def start(message): bot.send_message(message.chat.id, "Hello, World :)")