Update app.py
Browse files
app.py
CHANGED
@@ -99,20 +99,36 @@ TOKEN = "7766407698:AAGZHEbUuiOri4_YzZ7hDPSD6U8MGMXXSnA"
|
|
99 |
# Инициализация Teleflask
|
100 |
app = Teleflask(TOKEN)
|
101 |
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
#
|
113 |
-
@
|
114 |
-
def
|
115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
|
117 |
|
118 |
|
|
|
99 |
# Инициализация Teleflask
|
100 |
app = Teleflask(TOKEN)
|
101 |
|
102 |
+
@app.route("/")
|
103 |
+
def index():
|
104 |
+
return "This is a normal Flask page."
|
105 |
+
# end def
|
106 |
+
|
107 |
+
|
108 |
+
# Register the /start command
|
109 |
+
@bot.command("start")
|
110 |
+
def start(update, text):
|
111 |
+
# update is the update object. It is of type pytgbot.api_types.receivable.updates.Update
|
112 |
+
# text is the text after the command. Can be empty. Type is str.
|
113 |
+
return TextMessage("<b>Hello!</b> Thanks for using @" + bot.username + "!", parse_mode="html")
|
114 |
+
# end def
|
115 |
+
|
116 |
+
|
117 |
+
# register a function to be called for updates.
|
118 |
+
@bot.on_update
|
119 |
+
def foo(update):
|
120 |
+
from pytgbot.api_types.receivable.updates import Update
|
121 |
+
assert isinstance(update, Update)
|
122 |
+
# do stuff with the update
|
123 |
+
# you can use bot.bot to access the pytgbot.Bot's messages functions
|
124 |
+
if not update.message:
|
125 |
+
return
|
126 |
+
# you could use @bot.on_message instead of this if.
|
127 |
+
# end if
|
128 |
+
if update.message.new_chat_member:
|
129 |
+
return TextMessage("Welcome!")
|
130 |
+
# end if
|
131 |
+
# end def
|
132 |
|
133 |
|
134 |
|