Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1"""LICENSE 

2Copyright 2020 Hermann Krumrey <hermann@krumreyh.com> 

3 

4This file is part of otaku-info-web. 

5 

6otaku-info-web is free software: you can redistribute it and/or modify 

7it under the terms of the GNU General Public License as published by 

8the Free Software Foundation, either version 3 of the License, or 

9(at your option) any later version. 

10 

11otaku-info-web is distributed in the hope that it will be useful, 

12but WITHOUT ANY WARRANTY; without even the implied warranty of 

13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

14GNU General Public License for more details. 

15 

16You should have received a copy of the GNU General Public License 

17along with otaku-info-web. If not, see <http://www.gnu.org/licenses/>. 

18LICENSE""" 

19 

20import os 

21from typing import Type 

22from puffotter.flask.Config import Config as BaseConfig 

23from bokkichat.settings.impl.TelegramBotSettings import TelegramBotSettings 

24from bokkichat.connection.impl.TelegramBotConnection import \ 

25 TelegramBotConnection 

26 

27 

28class Config(BaseConfig): 

29 """ 

30 Configuration for the flask application 

31 """ 

32 

33 TELEGRAM_API_KEY: str 

34 """ 

35 API Key for the telegram bot used for notification messages 

36 """ 

37 

38 TELEGRAM_BOT_CONNECTION: TelegramBotConnection 

39 """ 

40 Single Telegram bot connection used for all telegram communications 

41 """ 

42 

43 @classmethod 

44 def _load_extras(cls, parent: Type[BaseConfig]): 

45 """ 

46 Loads non-standard configuration variables 

47 :param parent: The base configuration 

48 :return: None 

49 """ 

50 from otaku_info_web.template_extras import profile_extras 

51 parent.TEMPLATE_EXTRAS.update({ 

52 "profile": profile_extras 

53 }) 

54 Config.TELEGRAM_API_KEY = os.environ["TELEGRAM_API_KEY"] 

55 

56 @classmethod 

57 def initialize_telegram(cls): 

58 """ 

59 Initializes the telegram bot connection 

60 :return: None 

61 """ 

62 Config.TELEGRAM_BOT_CONNECTION = TelegramBotConnection( 

63 TelegramBotSettings(Config.TELEGRAM_API_KEY) 

64 )