[O] Specify types
This commit is contained in:
+1
-1
@@ -19,7 +19,7 @@ if __name__ == '__main__':
|
|||||||
print("Bot created: ", bot.getMe())
|
print("Bot created: ", bot.getMe())
|
||||||
|
|
||||||
# Create updater
|
# Create updater
|
||||||
updater = Updater(bot=bot)
|
updater = Updater(bot=bot, use_context=True)
|
||||||
dispatcher = updater.dispatcher
|
dispatcher = updater.dispatcher
|
||||||
|
|
||||||
# Register commands
|
# Register commands
|
||||||
|
|||||||
+12
-9
@@ -1,6 +1,9 @@
|
|||||||
import re
|
import re
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
|
from telegram import Bot, Update
|
||||||
|
from telegram.ext import Updater, CallbackContext
|
||||||
|
|
||||||
from src.database import Database
|
from src.database import Database
|
||||||
from src.utils import toJson, create
|
from src.utils import toJson, create
|
||||||
|
|
||||||
@@ -35,14 +38,14 @@ urlValidator = re.compile(
|
|||||||
database = Database()
|
database = Database()
|
||||||
|
|
||||||
|
|
||||||
def start(update, context):
|
def start(update: Update, context: CallbackContext):
|
||||||
chat = update.effective_chat
|
chat = update.effective_chat
|
||||||
database.checkUser(chat.id)
|
database.checkUser(chat.id)
|
||||||
|
|
||||||
return helpMsg
|
return helpMsg
|
||||||
|
|
||||||
|
|
||||||
def ls(update, context):
|
def ls(update: Update, context: CallbackContext):
|
||||||
chat = update.effective_chat
|
chat = update.effective_chat
|
||||||
user = database.checkUser(chat.id)
|
user = database.checkUser(chat.id)
|
||||||
requests = database.userRequests[user]
|
requests = database.userRequests[user]
|
||||||
@@ -50,7 +53,7 @@ def ls(update, context):
|
|||||||
return "Your requests: %s" % toJson(requests)
|
return "Your requests: %s" % toJson(requests)
|
||||||
|
|
||||||
|
|
||||||
def touch(update, context):
|
def touch(update: Update, context: CallbackContext):
|
||||||
chat = update.effective_chat
|
chat = update.effective_chat
|
||||||
user = database.checkUser(chat.id)
|
user = database.checkUser(chat.id)
|
||||||
|
|
||||||
@@ -82,7 +85,7 @@ def touch(update, context):
|
|||||||
return "%s is successfully created!" % name
|
return "%s is successfully created!" % name
|
||||||
|
|
||||||
|
|
||||||
def rm(update, context):
|
def rm(update: Update, context: CallbackContext):
|
||||||
chat = update.effective_chat
|
chat = update.effective_chat
|
||||||
user = database.checkUser(chat.id)
|
user = database.checkUser(chat.id)
|
||||||
|
|
||||||
@@ -102,12 +105,12 @@ def rm(update, context):
|
|||||||
return "%s is successfully removed!" % name
|
return "%s is successfully removed!" % name
|
||||||
|
|
||||||
|
|
||||||
def nano(update, context):
|
def nano(update: Update, context: CallbackContext):
|
||||||
chat = update.effective_chat
|
chat = update.effective_chat
|
||||||
user = database.checkUser(chat.id)
|
user = database.checkUser(chat.id)
|
||||||
|
|
||||||
|
|
||||||
def test(update, context):
|
def test(update: Update, context: CallbackContext):
|
||||||
chat = update.effective_chat
|
chat = update.effective_chat
|
||||||
user = database.checkUser(chat.id)
|
user = database.checkUser(chat.id)
|
||||||
|
|
||||||
@@ -130,16 +133,16 @@ def test(update, context):
|
|||||||
return 'Done!'
|
return 'Done!'
|
||||||
|
|
||||||
|
|
||||||
def interval(update, context):
|
def interval(update: Update, context: CallbackContext):
|
||||||
chat = update.effective_chat
|
chat = update.effective_chat
|
||||||
user = database.checkUser(chat.id)
|
user = database.checkUser(chat.id)
|
||||||
|
|
||||||
|
|
||||||
def enable(update, context):
|
def enable(update: Update, context: CallbackContext):
|
||||||
chat = update.effective_chat
|
chat = update.effective_chat
|
||||||
user = database.checkUser(chat.id)
|
user = database.checkUser(chat.id)
|
||||||
|
|
||||||
|
|
||||||
def disable(update, context):
|
def disable(update: Update, context: CallbackContext):
|
||||||
chat = update.effective_chat
|
chat = update.effective_chat
|
||||||
user = database.checkUser(chat.id)
|
user = database.checkUser(chat.id)
|
||||||
|
|||||||
Reference in New Issue
Block a user