forked from sh-edraft.de/sh_discord_bot
Added restart command
This commit is contained in:
parent
b9697afd6d
commit
90a517d2b1
@ -5,21 +5,17 @@
|
||||
"bot": "src/bot/bot.json",
|
||||
"bot-core": "src/bot_core/bot-core.json",
|
||||
"bot-data": "src/bot_data/bot-data.json",
|
||||
"database": "src/modules/database/database.json",
|
||||
"admin": "src/modules/admin/admin.json",
|
||||
"base": "src/modules/base/base.json",
|
||||
"permission": "src/modules/permission/permission.json",
|
||||
"boot-log": "src/modules/boot_log/boot-log.json"
|
||||
"boot-log": "src/modules/boot_log/boot-log.json",
|
||||
"database": "src/modules/database/database.json",
|
||||
"moderator": "src/modules/moderator/moderator.json",
|
||||
"permission": "src/modules/permission/permission.json"
|
||||
},
|
||||
"Scripts": {
|
||||
"prod": "export KDB_ENVIRONMENT=production; export KDB_NAME=KDB-Prod; cpl start;",
|
||||
"stage": "export KDB_ENVIRONMENT=staging; export KDB_NAME=KDB-Stage; cpl start;",
|
||||
"dev": "export KDB_ENVIRONMENT=development; export KDB_NAME=KDB-Dev; cpl start;",
|
||||
|
||||
"ba": "cpl build-all",
|
||||
"build-all": "cpl build-bot; cpl build-bot-core; cpl build-bot-data;",
|
||||
"build-bot": "echo 'Build bot'; cd ./src/bot; cpl build; cd ../../;",
|
||||
"build-bot-core": "echo 'Build bot-core'; cd ./src/bot_core; cpl build; cd ../../;",
|
||||
"build-bot-data": "echo 'Build bot-data'; cd ./src/bot_data; cpl build; cd ../../;"
|
||||
"dev": "export KDB_ENVIRONMENT=development; export KDB_NAME=KDB-Dev; cpl start;"
|
||||
}
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@ __title__ = 'bot'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
|
||||
__version__ = '1.0.0.dev1'
|
||||
__version__ = '1.0.0.dev2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev1')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev2')
|
||||
|
@ -66,3 +66,6 @@ class Application(DiscordBotApplicationABC):
|
||||
self._logger.error(__name__, 'stop failed', e)
|
||||
|
||||
Console.write_line()
|
||||
|
||||
def is_restart(self):
|
||||
return True if self._configuration.get_configuration('IS_RESTART') == 'true' else False
|
||||
|
@ -4,7 +4,7 @@
|
||||
"Version": {
|
||||
"Major": "1",
|
||||
"Minor": "0",
|
||||
"Micro": "0.dev1"
|
||||
"Micro": "0.dev2"
|
||||
},
|
||||
"Author": "Sven Heidemann",
|
||||
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
||||
@ -50,7 +50,9 @@
|
||||
"../modules/base/base.json",
|
||||
"../modules/boot_log/boot-log.json",
|
||||
"../modules/database/database.json",
|
||||
"../modules/permission/permission.json"
|
||||
"../modules/permission/permission.json",
|
||||
"../modules/admin/admin.json",
|
||||
"../modules/moderator/moderator.json"
|
||||
]
|
||||
}
|
||||
}
|
@ -17,7 +17,7 @@
|
||||
},
|
||||
"DiscordBot": {
|
||||
"Token": "OTk4MTYwNDI3Njg5MTgxMjM3.GI7h67.BqD6Lu1Tz0MuG8iktYrcLnHi1pNozyMiWFGTKI",
|
||||
"Prefix": "!kde "
|
||||
"Prefix": "!ke "
|
||||
},
|
||||
"Bot": {
|
||||
"910199451145076828": {
|
||||
|
@ -2,6 +2,7 @@ import asyncio
|
||||
from typing import Optional
|
||||
|
||||
from cpl_core.application import ApplicationBuilder
|
||||
from cpl_core.console import Console
|
||||
|
||||
from bot.application import Application
|
||||
from bot.startup import Startup
|
||||
@ -11,31 +12,46 @@ from modules.boot_log.boot_log_extension import BootLogExtension
|
||||
from modules.database.database_extension import DatabaseExtension
|
||||
|
||||
|
||||
class Main:
|
||||
class Program:
|
||||
|
||||
def __init__(self):
|
||||
self._app: Optional[Application] = None
|
||||
self.app: Optional[Application] = None
|
||||
|
||||
async def main(self):
|
||||
async def start(self):
|
||||
app_builder = ApplicationBuilder(Application)
|
||||
app_builder.use_extension(StartupDiscordExtension)
|
||||
app_builder.use_extension(StartupMigrationExtension)
|
||||
app_builder.use_extension(BootLogExtension)
|
||||
app_builder.use_extension(DatabaseExtension)
|
||||
app_builder.use_startup(Startup)
|
||||
self._app: Application = await app_builder.build_async()
|
||||
await self._app.run_async()
|
||||
self.app: Application = await app_builder.build_async()
|
||||
await self.app.run_async()
|
||||
|
||||
async def stop(self):
|
||||
await self._app.stop_async()
|
||||
await self.app.stop_async()
|
||||
|
||||
|
||||
def main():
|
||||
program = Program()
|
||||
try:
|
||||
asyncio.run(program.start())
|
||||
except KeyboardInterrupt:
|
||||
asyncio.run(program.stop())
|
||||
except Exception as e:
|
||||
Console.error(f'[ ERROR ] [ {__name__} ]: Cannot start the bot', str(e))
|
||||
finally:
|
||||
try:
|
||||
asyncio.run(program.stop())
|
||||
except Exception as e:
|
||||
Console.error(f'[ ERROR ] [ {__name__} ]: Cannot stop the bot', str(e))
|
||||
|
||||
if program.app is not None and program.app.is_restart():
|
||||
del program
|
||||
main()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main = Main()
|
||||
try:
|
||||
asyncio.run(main.main())
|
||||
except KeyboardInterrupt:
|
||||
asyncio.run(main.stop())
|
||||
main()
|
||||
|
||||
# ((
|
||||
# ( `)
|
||||
|
@ -5,6 +5,7 @@ from cpl_core.environment import ApplicationEnvironmentABC
|
||||
from cpl_discord import get_discord_collection
|
||||
from cpl_discord.discord_event_types_enum import DiscordEventTypesEnum
|
||||
|
||||
from modules.admin.command.restart_command import RestartCommand
|
||||
from modules.base.command.afk_command import AFKCommand
|
||||
from modules.base.command.help_command import HelpCommand
|
||||
from modules.base.command.info_command import InfoCommand
|
||||
@ -33,11 +34,15 @@ class StartupDiscordExtension(StartupExtensionABC):
|
||||
services.add_discord()
|
||||
dc = get_discord_collection(services)
|
||||
""" commands """
|
||||
# admin
|
||||
dc.add_command(RestartCommand)
|
||||
# moderator
|
||||
dc.add_command(PurgeCommand)
|
||||
# simple
|
||||
dc.add_command(AFKCommand)
|
||||
dc.add_command(HelpCommand)
|
||||
dc.add_command(InfoCommand)
|
||||
dc.add_command(PingCommand)
|
||||
dc.add_command(PurgeCommand)
|
||||
dc.add_command(UserInfoCommand)
|
||||
""" events """
|
||||
# on_member_join
|
||||
|
@ -6,6 +6,10 @@
|
||||
"not_implemented_yet": "Ey Alter, das kann ich noch nicht..."
|
||||
},
|
||||
"modules": {
|
||||
"admin": {
|
||||
"restart_message": "Bin gleich wieder da :D"
|
||||
},
|
||||
"moderator": {},
|
||||
"base": {
|
||||
"welcome_message": "Hello There!\nIch heiße dich bei {} herzlichst willkommen!",
|
||||
"welcome_message_for_team": "{} hat gerade das Irrenhaus betreten.",
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'bot_core'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
|
||||
__version__ = '1.0.0.dev1'
|
||||
__version__ = '1.0.0.dev2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev1')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev2')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'bot_core.abc'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
|
||||
__version__ = '1.0.0.dev1'
|
||||
__version__ = '1.0.0.dev2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev1')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev2')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'bot_core.configuration'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
|
||||
__version__ = '1.0.0.dev1'
|
||||
__version__ = '1.0.0.dev2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev1')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev2')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'bot_core.pipes'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
|
||||
__version__ = '1.0.0.dev1'
|
||||
__version__ = '1.0.0.dev2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev1')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev2')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'bot_core.service'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
|
||||
__version__ = '1.0.0.dev1'
|
||||
__version__ = '1.0.0.dev2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev1')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev2')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'bot_data'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
|
||||
__version__ = '1.0.0.dev1'
|
||||
__version__ = '1.0.0.dev2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev1')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev2')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'bot_data.abc'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
|
||||
__version__ = '1.0.0.dev1'
|
||||
__version__ = '1.0.0.dev2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev1')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev2')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'bot_data.migration'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
|
||||
__version__ = '1.0.0.dev1'
|
||||
__version__ = '1.0.0.dev2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev1')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev2')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'bot_data.model'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
|
||||
__version__ = '1.0.0.dev1'
|
||||
__version__ = '1.0.0.dev2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev1')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev2')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'bot_data.service'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
|
||||
__version__ = '1.0.0.dev1'
|
||||
__version__ = '1.0.0.dev2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev1')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev2')
|
||||
|
26
src/modules/admin/__init__.py
Normal file
26
src/modules/admin/__init__.py
Normal file
@ -0,0 +1,26 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
bot Keksdose bot
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Discord bot for the Keksdose discord Server
|
||||
|
||||
:copyright: (c) 2022 sh-edraft.de
|
||||
:license: MIT, see LICENSE for more details.
|
||||
|
||||
"""
|
||||
|
||||
__title__ = 'modules.admin'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
|
||||
__version__ = '1.0.0.dev2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev2')
|
46
src/modules/admin/admin.json
Normal file
46
src/modules/admin/admin.json
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
"ProjectSettings": {
|
||||
"Name": "admin",
|
||||
"Version": {
|
||||
"Major": "0",
|
||||
"Minor": "0",
|
||||
"Micro": "0"
|
||||
},
|
||||
"Author": "",
|
||||
"AuthorEmail": "",
|
||||
"Description": "",
|
||||
"LongDescription": "",
|
||||
"URL": "",
|
||||
"CopyrightDate": "",
|
||||
"CopyrightName": "",
|
||||
"LicenseName": "",
|
||||
"LicenseDescription": "",
|
||||
"Dependencies": [
|
||||
"cpl-core>=2022.7.0.post5"
|
||||
],
|
||||
"DevDependencies": [
|
||||
"cpl-cli>=2022.7.0.post2"
|
||||
],
|
||||
"PythonVersion": ">=3.10.4",
|
||||
"PythonPath": {
|
||||
"linux": ""
|
||||
},
|
||||
"Classifiers": []
|
||||
},
|
||||
"BuildSettings": {
|
||||
"ProjectType": "library",
|
||||
"SourcePath": "",
|
||||
"OutputPath": "../../dist",
|
||||
"Main": "admin.main",
|
||||
"EntryPoint": "admin",
|
||||
"IncludePackageData": false,
|
||||
"Included": [],
|
||||
"Excluded": [
|
||||
"*/__pycache__",
|
||||
"*/logs",
|
||||
"*/tests"
|
||||
],
|
||||
"PackageData": {},
|
||||
"ProjectReferences": []
|
||||
}
|
||||
}
|
0
src/modules/admin/command/__init__.py
Normal file
0
src/modules/admin/command/__init__.py
Normal file
52
src/modules/admin/command/restart_command.py
Normal file
52
src/modules/admin/command/restart_command.py
Normal file
@ -0,0 +1,52 @@
|
||||
from cpl_core.configuration import ConfigurationABC
|
||||
from cpl_core.logging import LoggerABC
|
||||
from cpl_discord.command import DiscordCommandABC
|
||||
from cpl_discord.service import DiscordBotServiceABC
|
||||
from cpl_translation import TranslatePipe
|
||||
from discord.ext import commands
|
||||
from discord.ext.commands import Context
|
||||
|
||||
from bot_core.abc.client_utils_service_abc import ClientUtilsServiceABC
|
||||
from bot_core.abc.message_service_abc import MessageServiceABC
|
||||
from modules.permission.abc.permission_service_abc import PermissionServiceABC
|
||||
|
||||
|
||||
class RestartCommand(DiscordCommandABC):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
logger: LoggerABC,
|
||||
config: ConfigurationABC,
|
||||
message_service: MessageServiceABC,
|
||||
bot: DiscordBotServiceABC,
|
||||
client_utils: ClientUtilsServiceABC,
|
||||
translate: TranslatePipe,
|
||||
permissions: PermissionServiceABC,
|
||||
):
|
||||
DiscordCommandABC.__init__(self)
|
||||
|
||||
self._logger = logger
|
||||
self._config = config
|
||||
self._message_service = message_service
|
||||
self._bot = bot
|
||||
self._client_utils = client_utils
|
||||
self._t = translate
|
||||
self._permissions = permissions
|
||||
|
||||
self._logger.trace(__name__, f'Loaded command service: {type(self).__name__}')
|
||||
|
||||
@commands.command()
|
||||
async def restart(self, ctx: Context):
|
||||
self._logger.debug(__name__, f'Received command restart {ctx}')
|
||||
self._client_utils.received_command(ctx.guild.id)
|
||||
|
||||
if not self._permissions.is_member_moderator(ctx.author):
|
||||
await self._message_service.send_ctx_msg(ctx, self._t.transform('common.no_permission_message'))
|
||||
self._logger.trace(__name__, f'Finished restart command')
|
||||
return
|
||||
|
||||
self._config.add_configuration('IS_RESTART', 'true')
|
||||
await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.admin.restart_message'))
|
||||
await self._bot.logout()
|
||||
|
||||
self._logger.trace(__name__, f'Finished restart command')
|
@ -15,7 +15,7 @@ __title__ = 'modules.base'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
|
||||
__version__ = '1.0.0.dev1'
|
||||
__version__ = '1.0.0.dev2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev1')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev2')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'modules.base.abc'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
|
||||
__version__ = '1.0.0.dev1'
|
||||
__version__ = '1.0.0.dev2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev1')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev2')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'modules.base.command'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
|
||||
__version__ = '1.0.0.dev1'
|
||||
__version__ = '1.0.0.dev2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev1')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev2')
|
||||
|
@ -1,5 +1,4 @@
|
||||
from cpl_core.configuration import ConfigurationABC
|
||||
from cpl_core.database.context import DatabaseContext
|
||||
from cpl_core.logging import LoggerABC
|
||||
from cpl_discord.command import DiscordCommandABC
|
||||
from cpl_discord.service import DiscordBotServiceABC
|
||||
@ -10,8 +9,6 @@ from discord.ext.commands import Context
|
||||
|
||||
from bot_core.abc.client_utils_service_abc import ClientUtilsServiceABC
|
||||
from bot_core.abc.message_service_abc import MessageServiceABC
|
||||
from bot_core.configuration.server_settings import ServerSettings
|
||||
from bot_data.abc.client_repository_abc import ClientRepositoryABC
|
||||
from modules.base.configuration.base_server_settings import BaseServerSettings
|
||||
|
||||
|
||||
@ -22,8 +19,6 @@ class AFKCommand(DiscordCommandABC):
|
||||
logger: LoggerABC,
|
||||
config: ConfigurationABC,
|
||||
message_service: MessageServiceABC,
|
||||
clients: ClientRepositoryABC,
|
||||
db: DatabaseContext,
|
||||
bot: DiscordBotServiceABC,
|
||||
client_utils: ClientUtilsServiceABC,
|
||||
translate: TranslatePipe
|
||||
@ -33,8 +28,6 @@ class AFKCommand(DiscordCommandABC):
|
||||
self._logger = logger
|
||||
self._config = config
|
||||
self._message_service = message_service
|
||||
self._clients = clients
|
||||
self._db = db
|
||||
self._bot = bot
|
||||
self._client_utils = client_utils
|
||||
self._t = translate
|
||||
@ -46,7 +39,6 @@ class AFKCommand(DiscordCommandABC):
|
||||
self._logger.debug(__name__, f'Received command afk {ctx}')
|
||||
self._client_utils.received_command(ctx.guild.id)
|
||||
settings: BaseServerSettings = self._config.get_configuration(f'BaseServerSettings_{ctx.guild.id}')
|
||||
server_settings: ServerSettings = self._config.get_configuration(f'ServerSettings_{ctx.guild.id}')
|
||||
|
||||
if ctx.author.voice is None or ctx.author.voice.channel is None:
|
||||
await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.base.afk_command_channel_missing_message'))
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'modules.base.configuration'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
|
||||
__version__ = '1.0.0.dev1'
|
||||
__version__ = '1.0.0.dev2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev1')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev2')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'modules.base.events'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
|
||||
__version__ = '1.0.0.dev1'
|
||||
__version__ = '1.0.0.dev2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev1')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev2')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'modules.base.service'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
|
||||
__version__ = '1.0.0.dev1'
|
||||
__version__ = '1.0.0.dev2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev1')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev2')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'modules.boot_log'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
|
||||
__version__ = '1.0.0.dev1'
|
||||
__version__ = '1.0.0.dev2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev1')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev2')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'modules.boot_log.configuration'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
|
||||
__version__ = '1.0.0.dev1'
|
||||
__version__ = '1.0.0.dev2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev1')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev2')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'modules.database'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
|
||||
__version__ = '1.0.0.dev1'
|
||||
__version__ = '1.0.0.dev2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev1')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev2')
|
||||
|
26
src/modules/moderator/__init__.py
Normal file
26
src/modules/moderator/__init__.py
Normal file
@ -0,0 +1,26 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
bot Keksdose bot
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Discord bot for the Keksdose discord Server
|
||||
|
||||
:copyright: (c) 2022 sh-edraft.de
|
||||
:license: MIT, see LICENSE for more details.
|
||||
|
||||
"""
|
||||
|
||||
__title__ = 'modules.moderator'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
|
||||
__version__ = '1.0.0.dev2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev2')
|
46
src/modules/moderator/moderator.json
Normal file
46
src/modules/moderator/moderator.json
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
"ProjectSettings": {
|
||||
"Name": "moderator",
|
||||
"Version": {
|
||||
"Major": "0",
|
||||
"Minor": "0",
|
||||
"Micro": "0"
|
||||
},
|
||||
"Author": "",
|
||||
"AuthorEmail": "",
|
||||
"Description": "",
|
||||
"LongDescription": "",
|
||||
"URL": "",
|
||||
"CopyrightDate": "",
|
||||
"CopyrightName": "",
|
||||
"LicenseName": "",
|
||||
"LicenseDescription": "",
|
||||
"Dependencies": [
|
||||
"cpl-core>=2022.7.0.post5"
|
||||
],
|
||||
"DevDependencies": [
|
||||
"cpl-cli>=2022.7.0.post2"
|
||||
],
|
||||
"PythonVersion": ">=3.10.4",
|
||||
"PythonPath": {
|
||||
"linux": ""
|
||||
},
|
||||
"Classifiers": []
|
||||
},
|
||||
"BuildSettings": {
|
||||
"ProjectType": "library",
|
||||
"SourcePath": "",
|
||||
"OutputPath": "../../dist",
|
||||
"Main": "moderator.main",
|
||||
"EntryPoint": "moderator",
|
||||
"IncludePackageData": false,
|
||||
"Included": [],
|
||||
"Excluded": [
|
||||
"*/__pycache__",
|
||||
"*/logs",
|
||||
"*/tests"
|
||||
],
|
||||
"PackageData": {},
|
||||
"ProjectReferences": []
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@ __title__ = 'modules.permission'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
|
||||
__version__ = '1.0.0.dev1'
|
||||
__version__ = '1.0.0.dev2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev1')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev2')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'modules.permission.abc'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
|
||||
__version__ = '1.0.0.dev1'
|
||||
__version__ = '1.0.0.dev2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev1')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev2')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'modules.permission.configuration'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
|
||||
__version__ = '1.0.0.dev1'
|
||||
__version__ = '1.0.0.dev2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev1')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev2')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'modules.permission.events'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
|
||||
__version__ = '1.0.0.dev1'
|
||||
__version__ = '1.0.0.dev2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev1')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev2')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'modules.permission.service'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
|
||||
__version__ = '1.0.0.dev1'
|
||||
__version__ = '1.0.0.dev2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev1')
|
||||
version_info = VersionInfo(major='1', minor='0', micro='0.dev2')
|
||||
|
Loading…
Reference in New Issue
Block a user