-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* plugins * plugins * add handlers attr for plugins * finish smart-plugins * auto load when run * add filters at first * add plugins example
- Loading branch information
Showing
5 changed files
with
341 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import logging | ||
from tgram import TgBot | ||
|
||
logging.basicConfig(level=logging.DEBUG) | ||
|
||
bot = TgBot("API_TOKEN_HERE", parse_mode="Markdown", plugins="./plugins") | ||
|
||
bot.run_for_updates() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from tgram import TgBot, filters | ||
from tgram.types import CallbackQuery | ||
|
||
|
||
@TgBot.on_callback_query(filters.regex("^fine$")) | ||
def callback(bot: TgBot, query: CallbackQuery) -> bool: | ||
return query.answer("Good to know!", show_alert=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from tgram import TgBot, filters | ||
|
||
from tgram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton | ||
|
||
|
||
@TgBot.on_message(filters.command("start") & filters.private) | ||
async def on_start_message(bot: TgBot, m: Message) -> Message: | ||
return await m.reply_text( | ||
f"Hi {m.from_user.mention}!, How are you today?", | ||
reply_markup=InlineKeyboardMarkup( | ||
[[InlineKeyboardButton("I'm fine", callback_data="fine")]] | ||
), | ||
) |
Oops, something went wrong.