Added some config files
This commit is contained in:
		| @@ -1,25 +1 @@ | ||||
| # -*- coding: utf-8 -*- | ||||
|  | ||||
| """ | ||||
| gismo sh-edraft Gismo | ||||
| ~~~~~~~~~~~~~~~~~~~ | ||||
|  | ||||
| sh-edraft Dicord bot Gismo | ||||
|  | ||||
| :copyright: (c) 2021 - 2022 sh-edraft.de | ||||
| :license: MIT, see LICENSE for more details. | ||||
|  | ||||
| """ | ||||
|  | ||||
| __title__ = 'gismo_core' | ||||
| __author__ = 'Sven Heidemann' | ||||
| __license__ = 'MIT' | ||||
| __copyright__ = 'Copyright (c) 2021 - 2022 sh-edraft.de' | ||||
| __version__ = '0.1.0' | ||||
|  | ||||
| from collections import namedtuple | ||||
|  | ||||
| # imports:  | ||||
|  | ||||
| VersionInfo = namedtuple('VersionInfo', 'major minor micro') | ||||
| version_info = VersionInfo(major='0', minor='1', micro='0') | ||||
| # imports | ||||
|   | ||||
							
								
								
									
										1
									
								
								src/gismo_core/abc/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								src/gismo_core/abc/__init__.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| # imports | ||||
							
								
								
									
										13
									
								
								src/gismo_core/abc/bot_service_abc.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								src/gismo_core/abc/bot_service_abc.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| from abc import ABC, abstractmethod | ||||
|  | ||||
|  | ||||
| class BotServiceABC(ABC): | ||||
|  | ||||
|     @abstractmethod | ||||
|     def __init__(self): pass | ||||
|      | ||||
|     @abstractmethod | ||||
|     async def run(self): pass | ||||
|      | ||||
|     @abstractmethod | ||||
|     async def exit(self): pass | ||||
							
								
								
									
										1
									
								
								src/gismo_core/configuration/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								src/gismo_core/configuration/__init__.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| # imports | ||||
							
								
								
									
										23
									
								
								src/gismo_core/configuration/discord_settings.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								src/gismo_core/configuration/discord_settings.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | ||||
| import traceback | ||||
|  | ||||
| from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC | ||||
| from cpl_core.console import Console | ||||
|  | ||||
|  | ||||
| class DiscordSettings(ConfigurationModelABC): | ||||
|  | ||||
|     def __init__(self): | ||||
|         ConfigurationModelABC.__init__(self) | ||||
|  | ||||
|         self._token: str = '' | ||||
|  | ||||
|     @property | ||||
|     def token(self) -> str: | ||||
|         return self._token | ||||
|  | ||||
|     def from_dict(self, settings: dict): | ||||
|         try: | ||||
|             self._token = settings['Token'] | ||||
|         except Exception as e: | ||||
|             Console.error(f'[ ERROR ] [ {__name__} ]: Reading error in {self.__name__} settings') | ||||
|             Console.error(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}') | ||||
							
								
								
									
										1
									
								
								src/gismo_core/services/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								src/gismo_core/services/__init__.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| # imports | ||||
							
								
								
									
										15
									
								
								src/gismo_core/services/bot_service.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								src/gismo_core/services/bot_service.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | ||||
| from gismo_core.abc.bot_service_abc import BotServiceABC | ||||
| from gismo_core.configuration.discord_settings import DiscordSettings | ||||
|  | ||||
|  | ||||
| class BotService(BotServiceABC): | ||||
|  | ||||
|     def __init__(self, discord_settings: DiscordSettings): | ||||
|         # setup self | ||||
|         commands.Bot.__init__(self, command_prefix=discord_settings.bot.prefix, help_command=None) | ||||
|  | ||||
|     async def run(self): | ||||
|         pass | ||||
|  | ||||
|     async def exit(self): | ||||
|         pass | ||||
		Reference in New Issue
	
	Block a user