-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
61 lines (47 loc) · 1.54 KB
/
app.py
File metadata and controls
61 lines (47 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# https://docs.aiogram.dev/en/latest/
import re
import os
import asyncio
from battlefield.api.api_requests import onReadyCheck
import logging
from aiogram import Bot, Dispatcher, executor, types
from aiogram.contrib.fsm_storage.memory import MemoryStorage
from aiogram.dispatcher.filters.state import State, StatesGroup
API_TOKEN = os.environ["token"]
# Configure logging
logging.basicConfig(level=logging.INFO)
class StatState(StatesGroup):
bf2 = State()
bf3 = State()
bfh = State()
bf4 = State()
bf1 = State()
bf5 = State()
bf2weapongraph = State()
bf3weapongraph = State()
bfhweapongraph = State()
bf4weapongraph = State()
bf1weapongraph = State()
bf5weapongraph = State()
bf2vehiclegraph = State()
bf3vehiclegraph = State()
bfhvehiclegraph = State()
bf4vehiclegraph = State()
bf1vehiclegraph = State()
bf5vehiclegraph = State()
# Initialize bot and dispatcher
bot = Bot(token=API_TOKEN)
storage = MemoryStorage()
dp = Dispatcher(bot, storage=storage)
@dp.message_handler(commands=["start", "help"])
async def send_welcome(message: types.Message):
"""
This handler will be called when user sends `/start` or `/help` command
"""
await message.reply(
"This is the first initial version of the gamestats bot for telegram\nWe will start by adding the main commands:\n/bf1stats, /bf5stats, /bf4stats etc..."
)
from battlefield.handlers import *
if __name__ == "__main__":
asyncio.ensure_future(onReadyCheck())
executor.start_polling(dp, skip_updates=True)