summaryrefslogtreecommitdiff
path: root/Commands.py
diff options
context:
space:
mode:
authorDmitrii Morozov <snoopdesigns@gmail.com>2024-05-07 16:34:14 +0200
committerDmitrii Morozov <snoopdesigns@gmail.com>2024-05-07 16:34:14 +0200
commitf5c57d8e73f33ca1d7374a2662fbc7a4592eb7cd (patch)
tree6c6e931b4eadee43a1ee885e780b2b2b6b5ef56f /Commands.py
parent104c0b32a1e30a56900bb6a17ab9a009c54b76bb (diff)
Python code style
Diffstat (limited to 'Commands.py')
-rw-r--r--Commands.py94
1 files changed, 0 insertions, 94 deletions
diff --git a/Commands.py b/Commands.py
deleted file mode 100644
index e49d333..0000000
--- a/Commands.py
+++ /dev/null
@@ -1,94 +0,0 @@
-import telebot
-from TelegramBot import *
-from Formatter import *
-from persistence import *
-from FortniteClient import FortniteClient
-from pythonFortniteStatus.FortniteStatus import *
-
-class StartCommand(CommandHandler):
-
- __telegramBot: TelegramBot
- __userRepository: UserRepository
-
- def __init__(self, telegramBot: TelegramBot, userRepository: UserRepository):
- self.__telegramBot = telegramBot
- self.__userRepository = userRepository
-
- async def handle(self, message: telebot.types.Message):
- if message.chat.type == 'private':
- alias = message.chat.username
- else:
- alias = message.chat.title
- self.__userRepository.putUser(message.chat.id, alias)
- await self.__telegramBot.reply(message, 'This chat successfully registered to receive Fortnite updates')
-
-class GetStatusCommand(CommandHandler):
-
- __telegramBot: TelegramBot
- __fortniteStatus: FortniteStatus
-
- def __init__(self, telegramBot: TelegramBot):
- self.__telegramBot = telegramBot
- self.__fortniteStatus = FortniteStatus()
-
- async def handle(self, message: telebot.types.Message):
- await self.__telegramBot.reply(message, formatFortniteStatus(self.__fortniteStatus.getStatus()))
-
-class GetFriendsCommand(CommandHandler):
-
- __telegramBot: TelegramBot
- __fortniteClient: FortniteClient
-
- def __init__(self, telegramBot: TelegramBot, fortniteClient: FortniteClient):
- self.__telegramBot = telegramBot
- self.__fortniteClient = fortniteClient
-
- async def handle(self, message: telebot.types.Message):
- friends = await self.__fortniteClient.get_friends()
- await self.__telegramBot.reply(message, formatUsers(friends))
-
-
-class GetStatsCommand(CommandHandler):
-
- __telegramBot: TelegramBot
- __fortniteClient: FortniteClient
-
- def __init__(self, telegramBot: TelegramBot, fortniteClient: FortniteClient):
- self.__telegramBot = telegramBot
- self.__fortniteClient = fortniteClient
-
- async def handle(self, message: telebot.types.Message):
- friends = await self.__fortniteClient.get_friends()
- stats = [await friend.fetch_stats() for friend in friends]
- await self.__telegramBot.reply(message, formatUserStatsList(stats))
-
-class GetTodayStatsCommand(CommandHandler):
-
- __telegramBot: TelegramBot
- __fortniteClient: FortniteClient
- __statsRepository: StatsRepository
-
- def __init__(self, telegramBot: TelegramBot, fortniteClient: FortniteClient, statsRepository: StatsRepository):
- self.__telegramBot = telegramBot
- self.__fortniteClient = fortniteClient
- self.__statsRepository = statsRepository
-
- async def handle(self, message: telebot.types.Message):
- persisted_stats = self.__statsRepository.getStats()
- friends = await self.__fortniteClient.get_friends()
- current_stats = [await friend.fetch_stats() for friend in friends]
- await self.__telegramBot.reply(message, formatUserStatsDifference(persisted_stats, current_stats))
-
-class RecordStatsCommand(CommandHandler):
-
- __fortniteClient: FortniteClient
- __statsRepository: StatsRepository
-
- def __init__(self, fortniteClient: FortniteClient, statsRepository: StatsRepository):
- self.__fortniteClient = fortniteClient
- self.__statsRepository = statsRepository
-
- async def handle(self, message: telebot.types.Message):
- friends = await self.__fortniteClient.get_friends()
- for friend in friends:
- await self.__statsRepository.putStats(friend) \ No newline at end of file