Added project structure

This commit is contained in:
Sven Heidemann 2022-07-14 16:32:46 +02:00
parent ec2dcc2b4b
commit a781aaa41d
19 changed files with 336 additions and 3 deletions

6
.gitignore vendored
View File

@ -138,3 +138,9 @@ dmypy.json
# Cython debug symbols # Cython debug symbols
cython_debug/ cython_debug/
# custom vs code
PythonImportHelper-v2-Completion.json
appsettings.*.json
# idea
.idea/

0
LICENSE Normal file
View File

View File

@ -1,3 +0,0 @@
# kd_discord_bot
Discord moderation Bot for the Keksdose discord server.

15
appsettings.json Normal file
View File

@ -0,0 +1,15 @@
{
"TimeFormatSettings": {
"DateFormat": "%Y-%m-%d",
"TimeFormat": "%H:%M:%S",
"DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f",
"DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S"
},
"LoggingSettings": {
"Path": "logs/",
"Filename": "log_$start_time.log",
"ConsoleLogLevel": "ERROR",
"FileLogLevel": "WARN"
}
}

13
cpl-workspace.json Normal file
View File

@ -0,0 +1,13 @@
{
"WorkspaceSettings": {
"DefaultProject": "bot",
"Projects": {
"bot": "src/bot/bot.json",
"bot-commands": "src/bot_commands/bot-commands.json",
"bot-events": "src/bot_events/bot-events.json",
"bot-core": "src/bot_core/bot-core.json",
"bot-data": "src/bot_data/bot-data.json"
},
"Scripts": {}
}
}

1
src/bot/__init__.py Normal file
View File

@ -0,0 +1 @@
# imports:

16
src/bot/application.py Normal file
View File

@ -0,0 +1,16 @@
from cpl_core.application import ApplicationABC
from cpl_core.configuration import ConfigurationABC
from cpl_core.console import Console
from cpl_core.dependency_injection import ServiceProviderABC
class Application(ApplicationABC):
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
ApplicationABC.__init__(self, config, services)
async def configure(self):
pass
async def main(self):
Console.write_line('Hello World')

15
src/bot/appsettings.json Normal file
View File

@ -0,0 +1,15 @@
{
"TimeFormatSettings": {
"DateFormat": "%Y-%m-%d",
"TimeFormat": "%H:%M:%S",
"DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f",
"DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S"
},
"LoggingSettings": {
"Path": "logs/",
"Filename": "log_$start_time.log",
"ConsoleLogLevel": "ERROR",
"FileLogLevel": "WARN"
}
}

48
src/bot/bot.json Normal file
View File

@ -0,0 +1,48 @@
{
"ProjectSettings": {
"Name": "bot",
"Version": {
"Major": "1",
"Minor": "0",
"Micro": "0.dev1"
},
"Author": "Sven Heidemann",
"AuthorEmail": "sven.heidemann@sh-edraft.de",
"Description": "Keksdose bot",
"LongDescription": "Discord bot for the Keksdose discord Server",
"URL": "https://www.sh-edraft.de",
"CopyrightDate": "2022",
"CopyrightName": "sh-edraft.de",
"LicenseName": "MIT",
"LicenseDescription": "MIT, see LICENSE for more details.",
"Dependencies": [
"cpl-core>=2022.7.0",
"cpl-translation==2022.7.0",
"cpl-query==2022.7.0"
],
"DevDependencies": [
"cpl-cli>=2022.7.0.post1"
],
"PythonVersion": ">=3.10.4",
"PythonPath": {
"linux": ""
},
"Classifiers": []
},
"BuildSettings": {
"ProjectType": "console",
"SourcePath": "",
"OutputPath": "../../dist",
"Main": "bot.main",
"EntryPoint": "bot",
"IncludePackageData": false,
"Included": [],
"Excluded": [
"*/__pycache__",
"*/logs",
"*/tests"
],
"PackageData": {},
"ProjectReferences": []
}
}

18
src/bot/main.py Normal file
View File

@ -0,0 +1,18 @@
import asyncio
from cpl_core.application import ApplicationBuilder
from bot.application import Application
from bot.startup import Startup
async def main():
app_builder = ApplicationBuilder(Application)
app_builder.use_startup(Startup)
app: Application = await app_builder.build_async()
await app.run_async()
if __name__ == '__main__':
ml = asyncio.get_event_loop()
ml.run_until_complete(main())

16
src/bot/startup.py Normal file
View File

@ -0,0 +1,16 @@
from cpl_core.application import StartupABC
from cpl_core.configuration import ConfigurationABC
from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC
from cpl_core.environment import ApplicationEnvironment
class Startup(StartupABC):
def __init__(self):
StartupABC.__init__(self)
async def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC:
return configuration
async def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC:
return services.build_service_provider()

View File

@ -0,0 +1 @@
# imports:

View File

@ -0,0 +1,46 @@
{
"ProjectSettings": {
"Name": "bot-commands",
"Version": {
"Major": "1",
"Minor": "0",
"Micro": "0.dev1"
},
"Author": "Sven Heidemann",
"AuthorEmail": "sven.heidemann@sh-edraft.de",
"Description": "Keksdose bot - commands",
"LongDescription": "Discord bot for the Keksdose discord Server - command package",
"URL": "https://www.sh-edraft.de",
"CopyrightDate": "2022",
"CopyrightName": "sh-edraft.de",
"LicenseName": "MIT",
"LicenseDescription": "MIT, see LICENSE for more details.",
"Dependencies": [
"cpl-core>=2022.7.0"
],
"DevDependencies": [
"cpl-cli>=2022.7.0"
],
"PythonVersion": ">=3.10.4",
"PythonPath": {
"linux": ""
},
"Classifiers": []
},
"BuildSettings": {
"ProjectType": "console",
"SourcePath": "",
"OutputPath": "../../dist",
"Main": "",
"EntryPoint": "",
"IncludePackageData": false,
"Included": [],
"Excluded": [
"*/__pycache__",
"*/logs",
"*/tests"
],
"PackageData": {},
"ProjectReferences": []
}
}

1
src/bot_core/__init__.py Normal file
View File

@ -0,0 +1 @@
# imports:

View File

@ -0,0 +1,46 @@
{
"ProjectSettings": {
"Name": "bot-core",
"Version": {
"Major": "1",
"Minor": "0",
"Micro": "0.dev1"
},
"Author": "Sven Heidemann",
"AuthorEmail": "sven.heidemann@sh-edraft.de",
"Description": "Keksdose bot - core",
"LongDescription": "Discord bot for the Keksdose discord Server - core package",
"URL": "https://www.sh-edraft.de",
"CopyrightDate": "2022",
"CopyrightName": "sh-edraft.de",
"LicenseName": "MIT",
"LicenseDescription": "MIT, see LICENSE for more details.",
"Dependencies": [
"cpl-core>=2022.7.0"
],
"DevDependencies": [
"cpl-cli>=2022.7.0"
],
"PythonVersion": ">=3.10.4",
"PythonPath": {
"linux": ""
},
"Classifiers": []
},
"BuildSettings": {
"ProjectType": "console",
"SourcePath": "",
"OutputPath": "../../dist",
"Main": "",
"EntryPoint": "",
"IncludePackageData": false,
"Included": [],
"Excluded": [
"*/__pycache__",
"*/logs",
"*/tests"
],
"PackageData": {},
"ProjectReferences": []
}
}

1
src/bot_data/__init__.py Normal file
View File

@ -0,0 +1 @@
# imports:

View File

@ -0,0 +1,46 @@
{
"ProjectSettings": {
"Name": "bot-data",
"Version": {
"Major": "1",
"Minor": "0",
"Micro": "0.dev1"
},
"Author": "Sven Heidemann",
"AuthorEmail": "sven.heidemann@sh-edraft.de",
"Description": "Keksdose bot - data",
"LongDescription": "Discord bot for the Keksdose discord Server - database package",
"URL": "https://www.sh-edraft.de",
"CopyrightDate": "2022",
"CopyrightName": "sh-edraft.de",
"LicenseName": "MIT",
"LicenseDescription": "MIT, see LICENSE for more details.",
"Dependencies": [
"cpl-core>=2022.7.0"
],
"DevDependencies": [
"cpl-cli>=2022.7.0.post1"
],
"PythonVersion": ">=3.10.4",
"PythonPath": {
"linux": ""
},
"Classifiers": []
},
"BuildSettings": {
"ProjectType": "library",
"SourcePath": "",
"OutputPath": "../../dist",
"Main": "",
"EntryPoint": "",
"IncludePackageData": false,
"Included": [],
"Excluded": [
"*/__pycache__",
"*/logs",
"*/tests"
],
"PackageData": {},
"ProjectReferences": []
}
}

View File

@ -0,0 +1 @@
# imports:

View File

@ -0,0 +1,46 @@
{
"ProjectSettings": {
"Name": "bot-events",
"Version": {
"Major": "1",
"Minor": "0",
"Micro": "0.dev1"
},
"Author": "Sven Heidemann",
"AuthorEmail": "sven.heidemann@sh-edraft.de",
"Description": "Keksdose bot - events",
"LongDescription": "Discord bot for the Keksdose discord Server - event package",
"URL": "https://www.sh-edraft.de",
"CopyrightDate": "2022",
"CopyrightName": "sh-edraft.de",
"LicenseName": "MIT",
"LicenseDescription": "MIT, see LICENSE for more details.",
"Dependencies": [
"cpl-core>=2022.7.0"
],
"DevDependencies": [
"cpl-cli>=2022.7.0"
],
"PythonVersion": ">=3.10.4",
"PythonPath": {
"linux": ""
},
"Classifiers": []
},
"BuildSettings": {
"ProjectType": "console",
"SourcePath": "",
"OutputPath": "../../dist",
"Main": "",
"EntryPoint": "",
"IncludePackageData": false,
"Included": [],
"Excluded": [
"*/__pycache__",
"*/logs",
"*/tests"
],
"PackageData": {},
"ProjectReferences": []
}
}