Added cpl-discord project
This commit is contained in:
parent
2ab1576230
commit
a79358725c
@ -2,8 +2,9 @@
|
|||||||
"WorkspaceSettings": {
|
"WorkspaceSettings": {
|
||||||
"DefaultProject": "cpl-cli",
|
"DefaultProject": "cpl-cli",
|
||||||
"Projects": {
|
"Projects": {
|
||||||
"cpl-core": "src/cpl_core/cpl-core.json",
|
|
||||||
"cpl-cli": "src/cpl_cli/cpl-cli.json",
|
"cpl-cli": "src/cpl_cli/cpl-cli.json",
|
||||||
|
"cpl-core": "src/cpl_core/cpl-core.json",
|
||||||
|
"cpl-discord": "src/cpl_discord/cpl-discord.json",
|
||||||
"cpl-query": "src/cpl_query/cpl-query.json",
|
"cpl-query": "src/cpl_query/cpl-query.json",
|
||||||
"cpl-translation": "src/cpl_translation/cpl-translation.json",
|
"cpl-translation": "src/cpl_translation/cpl-translation.json",
|
||||||
"set-version": "tools/set_version/set-version.json",
|
"set-version": "tools/set_version/set-version.json",
|
||||||
@ -33,20 +34,22 @@
|
|||||||
"test": "cpl run unittests",
|
"test": "cpl run unittests",
|
||||||
|
|
||||||
"pre-build-all": "cpl sv $ARGS; cpl spu $ARGS;",
|
"pre-build-all": "cpl sv $ARGS; cpl spu $ARGS;",
|
||||||
"build-all": "cpl build-cli; cpl build-core; cpl build-query; cpl build-translation; cpl build-set-pip-urls; cpl build-set-version",
|
"build-all": "cpl build-cli; cpl build-core; cpl build-discord; cpl build-query; cpl build-translation; cpl build-set-pip-urls; cpl build-set-version",
|
||||||
"ba": "cpl build-all $ARGS",
|
"ba": "cpl build-all $ARGS",
|
||||||
"build-cli": "echo 'Build cpl-cli'; cd ./src/cpl_cli; cpl build; cd ../../;",
|
"build-cli": "echo 'Build cpl-cli'; cd ./src/cpl_cli; cpl build; cd ../../;",
|
||||||
"build-core": "echo 'Build cpl-core'; cd ./src/cpl_core; cpl build; cd ../../;",
|
"build-core": "echo 'Build cpl-core'; cd ./src/cpl_core; cpl build; cd ../../;",
|
||||||
|
"build-discord": "echo 'Build cpl-discord'; cd ./src/cpl_discord; cpl build; cd ../../;",
|
||||||
"build-query": "echo 'Build cpl-query'; cd ./src/cpl_query; cpl build; cd ../../;",
|
"build-query": "echo 'Build cpl-query'; cd ./src/cpl_query; cpl build; cd ../../;",
|
||||||
"build-translation": "echo 'Build cpl-translation'; cd ./src/cpl_translation; cpl build; cd ../../;",
|
"build-translation": "echo 'Build cpl-translation'; cd ./src/cpl_translation; cpl build; cd ../../;",
|
||||||
"build-set-pip-urls": "echo 'Build set-pip-urls'; cd ./tools/set_pip_urls; cpl build; cd ../../;",
|
"build-set-pip-urls": "echo 'Build set-pip-urls'; cd ./tools/set_pip_urls; cpl build; cd ../../;",
|
||||||
"build-set-version": "echo 'Build set-version'; cd ./tools/set_version; cpl build; cd ../../;",
|
"build-set-version": "echo 'Build set-version'; cd ./tools/set_version; cpl build; cd ../../;",
|
||||||
|
|
||||||
"pre-publish-all": "cpl sv $ARGS; cpl spu $ARGS;",
|
"pre-publish-all": "cpl sv $ARGS; cpl spu $ARGS;",
|
||||||
"publish-all": "cpl publish-cli; cpl publish-core; cpl publish-query; cpl publish-translation;",
|
"publish-all": "cpl publish-cli; cpl publish-core; cpl publish-discord; cpl publish-query; cpl publish-translation;",
|
||||||
"pa": "cpl build-all $ARGS",
|
"pa": "cpl build-all $ARGS",
|
||||||
"publish-cli": "echo 'Publish cpl-cli'; cd ./src/cpl_cli; cpl publish; cd ../../;",
|
"publish-cli": "echo 'Publish cpl-cli'; cd ./src/cpl_cli; cpl publish; cd ../../;",
|
||||||
"publish-core": "echo 'Publish cpl-core'; cd ./src/cpl_core; cpl publish; cd ../../;",
|
"publish-core": "echo 'Publish cpl-core'; cd ./src/cpl_core; cpl publish; cd ../../;",
|
||||||
|
"publish-discord": "echo 'Publish cpl-discord'; cd ./src/cpl_discord; cpl publish; cd ../../;",
|
||||||
"publish-query": "echo 'Publish cpl-query'; cd ./src/cpl_query; cpl publish; cd ../../;",
|
"publish-query": "echo 'Publish cpl-query'; cd ./src/cpl_query; cpl publish; cd ../../;",
|
||||||
"publish-translation": "echo 'Publish cpl-translation'; cd ./src/cpl_translation; cpl publish; cd ../../;",
|
"publish-translation": "echo 'Publish cpl-translation'; cd ./src/cpl_translation; cpl publish; cd ../../;",
|
||||||
|
|
||||||
@ -56,6 +59,9 @@
|
|||||||
"upload-prod-core": "echo 'PROD Upload cpl-core'; cpl upl-prod-core;",
|
"upload-prod-core": "echo 'PROD Upload cpl-core'; cpl upl-prod-core;",
|
||||||
"upl-prod-core": "twine upload -r pip.sh-edraft.de dist/cpl-core/publish/setup/*",
|
"upl-prod-core": "twine upload -r pip.sh-edraft.de dist/cpl-core/publish/setup/*",
|
||||||
|
|
||||||
|
"upload-prod-discord": "echo 'PROD Upload cpl-discord'; cpl upl-prod-discord;",
|
||||||
|
"upl-prod-discord": "twine upload -r pip.sh-edraft.de dist/cpl-discord/publish/setup/*",
|
||||||
|
|
||||||
"upload-prod-query": "echo 'PROD Upload cpl-query'; cpl upl-prod-query;",
|
"upload-prod-query": "echo 'PROD Upload cpl-query'; cpl upl-prod-query;",
|
||||||
"upl-prod-query": "twine upload -r pip.sh-edraft.de dist/cpl-query/publish/setup/*",
|
"upl-prod-query": "twine upload -r pip.sh-edraft.de dist/cpl-query/publish/setup/*",
|
||||||
|
|
||||||
@ -68,6 +74,9 @@
|
|||||||
"upload-exp-core": "echo 'EXP Upload cpl-core'; cpl upl-exp-core;",
|
"upload-exp-core": "echo 'EXP Upload cpl-core'; cpl upl-exp-core;",
|
||||||
"upl-exp-core": "twine upload -r pip-exp.sh-edraft.de dist/cpl-core/publish/setup/*",
|
"upl-exp-core": "twine upload -r pip-exp.sh-edraft.de dist/cpl-core/publish/setup/*",
|
||||||
|
|
||||||
|
"upload-exp-discord": "echo 'EXP Upload cpl-discord'; cpl upl-exp-discord;",
|
||||||
|
"upl-exp-discord": "twine upload -r pip-exp.sh-edraft.de dist/cpl-discord/publish/setup/*",
|
||||||
|
|
||||||
"upload-exp-query": "echo 'EXP Upload cpl-query'; cpl upl-exp-query;",
|
"upload-exp-query": "echo 'EXP Upload cpl-query'; cpl upl-exp-query;",
|
||||||
"upl-exp-query": "twine upload -r pip-exp.sh-edraft.de dist/cpl-query/publish/setup/*",
|
"upl-exp-query": "twine upload -r pip-exp.sh-edraft.de dist/cpl-query/publish/setup/*",
|
||||||
|
|
||||||
@ -80,6 +89,9 @@
|
|||||||
"upload-dev-core": "echo 'DEV Upload cpl-core'; cpl upl-dev-core;",
|
"upload-dev-core": "echo 'DEV Upload cpl-core'; cpl upl-dev-core;",
|
||||||
"upl-dev-core": "twine upload -r pip-dev.sh-edraft.de dist/cpl-core/publish/setup/*",
|
"upl-dev-core": "twine upload -r pip-dev.sh-edraft.de dist/cpl-core/publish/setup/*",
|
||||||
|
|
||||||
|
"upload-dev-discord": "echo 'DEV Upload cpl-discord'; cpl upl-dev-discord;",
|
||||||
|
"upl-dev-discord": "twine upload -r pip-dev.sh-edraft.de dist/cpl-discord/publish/setup/*",
|
||||||
|
|
||||||
"upload-dev-query": "echo 'DEV Upload cpl-query'; cpl upl-dev-query;",
|
"upload-dev-query": "echo 'DEV Upload cpl-query'; cpl upl-dev-query;",
|
||||||
"upl-dev-query": "twine upload -r pip-dev.sh-edraft.de dist/cpl-query/publish/setup/*",
|
"upl-dev-query": "twine upload -r pip-dev.sh-edraft.de dist/cpl-query/publish/setup/*",
|
||||||
|
|
||||||
@ -87,26 +99,29 @@
|
|||||||
"upl-dev-translation": "twine upload -r pip-dev.sh-edraft.de dist/cpl-translation/publish/setup/*",
|
"upl-dev-translation": "twine upload -r pip-dev.sh-edraft.de dist/cpl-translation/publish/setup/*",
|
||||||
|
|
||||||
"pre-deploy-prod": "cpl sv $ARGS; cpl spu --environment=production;",
|
"pre-deploy-prod": "cpl sv $ARGS; cpl spu --environment=production;",
|
||||||
"deploy-prod": "cpl deploy-prod-cli; cpl deploy-prod-core; cpl deploy-prod-query; cpl deploy-prod-translation;",
|
"deploy-prod": "cpl deploy-prod-cli; cpl deploy-prod-core; cpl deploy-prod-discord; cpl deploy-prod-query; cpl deploy-prod-translation;",
|
||||||
"dp": "cpl deploy-prod $ARGS",
|
"dp": "cpl deploy-prod $ARGS",
|
||||||
"deploy-prod-cli": "cpl publish-cli; cpl upload-prod-cli",
|
"deploy-prod-cli": "cpl publish-cli; cpl upload-prod-cli",
|
||||||
"deploy-prod-core": "cpl publish-core; cpl upload-prod-core",
|
"deploy-prod-core": "cpl publish-core; cpl upload-prod-core",
|
||||||
"deploy-prod-query": "cpl publish-query; cpl upload-prod-query",
|
"deploy-prod-query": "cpl publish-query; cpl upload-prod-query",
|
||||||
|
"deploy-prod-discord": "cpl publish-discord; cpl upload-prod-discord",
|
||||||
"deploy-prod-translation": "cpl publish-translation; cpl upload-prod-translation",
|
"deploy-prod-translation": "cpl publish-translation; cpl upload-prod-translation",
|
||||||
|
|
||||||
"pre-deploy-exp": "cpl sv $ARGS; cpl spu --environment=staging;",
|
"pre-deploy-exp": "cpl sv $ARGS; cpl spu --environment=staging;",
|
||||||
"deploy-exp": "cpl deploy-exp-cli; cpl deploy-exp-core; cpl deploy-exp-query; cpl deploy-exp-translation;",
|
"deploy-exp": "cpl deploy-exp-cli; cpl deploy-exp-core; cpl deploy-exp-discord; cpl deploy-exp-query; cpl deploy-exp-translation;",
|
||||||
"de": "cpl deploy-exp $ARGS",
|
"de": "cpl deploy-exp $ARGS",
|
||||||
"deploy-exp-cli": "cpl publish-cli; cpl upload-exp-cli",
|
"deploy-exp-cli": "cpl publish-cli; cpl upload-exp-cli",
|
||||||
"deploy-exp-core": "cpl publish-core; cpl upload-exp-core",
|
"deploy-exp-core": "cpl publish-core; cpl upload-exp-core",
|
||||||
|
"deploy-exp-discord": "cpl publish-discord; cpl upload-exp-discord",
|
||||||
"deploy-exp-query": "cpl publish-query; cpl upload-exp-query",
|
"deploy-exp-query": "cpl publish-query; cpl upload-exp-query",
|
||||||
"deploy-exp-translation": "cpl publish-translation; cpl upload-exp-translation",
|
"deploy-exp-translation": "cpl publish-translation; cpl upload-exp-translation",
|
||||||
|
|
||||||
"pre-deploy-dev": "cpl sv $ARGS; cpl spu --environment=development;",
|
"pre-deploy-dev": "cpl sv $ARGS; cpl spu --environment=development;",
|
||||||
"deploy-dev": "cpl deploy-dev-cli; cpl deploy-dev-core; cpl deploy-dev-query; cpl deploy-dev-translation;",
|
"deploy-dev": "cpl deploy-dev-cli; cpl deploy-dev-core; cpl deploy-dev-discord; cpl deploy-dev-query; cpl deploy-dev-translation;",
|
||||||
"dd": "cpl deploy-dev $ARGS",
|
"dd": "cpl deploy-dev $ARGS",
|
||||||
"deploy-dev-cli": "cpl publish-cli; cpl upload-dev-cli",
|
"deploy-dev-cli": "cpl publish-cli; cpl upload-dev-cli",
|
||||||
"deploy-dev-core": "cpl publish-core; cpl upload-dev-core",
|
"deploy-dev-core": "cpl publish-core; cpl upload-dev-core",
|
||||||
|
"deploy-dev-discord": "cpl publish-discord; cpl upload-dev-discord",
|
||||||
"deploy-dev-query": "cpl publish-query; cpl upload-dev-query",
|
"deploy-dev-query": "cpl publish-query; cpl upload-dev-query",
|
||||||
"deploy-dev-translation": "cpl publish-query; cpl upload-dev-translation",
|
"deploy-dev-translation": "cpl publish-query; cpl upload-dev-translation",
|
||||||
|
|
||||||
@ -114,6 +129,7 @@
|
|||||||
"di": "cpl dev-install",
|
"di": "cpl dev-install",
|
||||||
"di-core": "pip install cpl-core --pre --upgrade --extra-index-url https://pip-dev.sh-edraft.de",
|
"di-core": "pip install cpl-core --pre --upgrade --extra-index-url https://pip-dev.sh-edraft.de",
|
||||||
"di-cli": "pip install cpl-cli --pre --upgrade --extra-index-url https://pip-dev.sh-edraft.de",
|
"di-cli": "pip install cpl-cli --pre --upgrade --extra-index-url https://pip-dev.sh-edraft.de",
|
||||||
|
"di-discord": "pip install cpl-discord --pre --upgrade --extra-index-url https://pip-dev.sh-edraft.de",
|
||||||
"di-query": "pip install cpl-query --pre --upgrade --extra-index-url https://pip-dev.sh-edraft.de",
|
"di-query": "pip install cpl-query --pre --upgrade --extra-index-url https://pip-dev.sh-edraft.de",
|
||||||
"di-translation": "pip install cpl-translation --pre --upgrade --extra-index-url https://pip-dev.sh-edraft.de"
|
"di-translation": "pip install cpl-translation --pre --upgrade --extra-index-url https://pip-dev.sh-edraft.de"
|
||||||
}
|
}
|
||||||
|
1
src/cpl_discord/__init__.py
Normal file
1
src/cpl_discord/__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
# imports
|
0
src/cpl_discord/command/__init__.py
Normal file
0
src/cpl_discord/command/__init__.py
Normal file
11
src/cpl_discord/command/command_abc.py
Normal file
11
src/cpl_discord/command/command_abc.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
from abc import ABC, abstractmethod
|
||||||
|
|
||||||
|
from discord.ext import commands
|
||||||
|
|
||||||
|
from commands_meta import CommandsMeta
|
||||||
|
|
||||||
|
|
||||||
|
class CommandABC(ABC, commands.Cog, metaclass=CommandsMeta):
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def __init__(self): pass
|
5
src/cpl_discord/command/commands_meta.py
Normal file
5
src/cpl_discord/command/commands_meta.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
from abc import ABCMeta
|
||||||
|
from discord.ext import commands
|
||||||
|
|
||||||
|
|
||||||
|
class CommandsMeta(ABCMeta, commands.CogMeta): pass
|
1
src/cpl_discord/configuration/__init__.py
Normal file
1
src/cpl_discord/configuration/__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
# imports
|
29
src/cpl_discord/configuration/bot_settings.py
Normal file
29
src/cpl_discord/configuration/bot_settings.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import traceback
|
||||||
|
|
||||||
|
from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC
|
||||||
|
from cpl_core.console import Console
|
||||||
|
|
||||||
|
|
||||||
|
class BotSettings(ConfigurationModelABC):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
ConfigurationModelABC.__init__(self)
|
||||||
|
|
||||||
|
self._token = ''
|
||||||
|
self._prefix = ''
|
||||||
|
|
||||||
|
@property
|
||||||
|
def token(self) -> str:
|
||||||
|
return self._token
|
||||||
|
|
||||||
|
@property
|
||||||
|
def prefix(self) -> str:
|
||||||
|
return self._prefix
|
||||||
|
|
||||||
|
def from_dict(self, settings: dict):
|
||||||
|
try:
|
||||||
|
self._token = settings['Token']
|
||||||
|
self._prefix = settings['Prefix']
|
||||||
|
except Exception as e:
|
||||||
|
Console.error(f'[ ERROR ] [ {__name__} ]: Reading error in {__name__} settings')
|
||||||
|
Console.error(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}')
|
48
src/cpl_discord/cpl-discord.json
Normal file
48
src/cpl_discord/cpl-discord.json
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
"ProjectSettings": {
|
||||||
|
"Name": "cpl-discord",
|
||||||
|
"Version": {
|
||||||
|
"Major": "2022",
|
||||||
|
"Minor": "7",
|
||||||
|
"Micro": "0"
|
||||||
|
},
|
||||||
|
"Author": "Sven Heidemann",
|
||||||
|
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
||||||
|
"Description": "sh-edraft Common Python library Discord",
|
||||||
|
"LongDescription": "sh-edraft Common Python library link between discord.py and CPL",
|
||||||
|
"URL": "https://www.sh-edraft.de",
|
||||||
|
"CopyrightDate": "2021 - 2022",
|
||||||
|
"CopyrightName": "sh-edraft.de",
|
||||||
|
"LicenseName": "MIT",
|
||||||
|
"LicenseDescription": "MIT, see LICENSE for more details.",
|
||||||
|
"Dependencies": [
|
||||||
|
"cpl-core>=2022.7.0",
|
||||||
|
"discord.py==1.7.3",
|
||||||
|
"cpl-query==2022.6.0"
|
||||||
|
],
|
||||||
|
"DevDependencies": [
|
||||||
|
"cpl-cli>=2022.7.0"
|
||||||
|
],
|
||||||
|
"PythonVersion": ">=3.10.4",
|
||||||
|
"PythonPath": {
|
||||||
|
"linux": ""
|
||||||
|
},
|
||||||
|
"Classifiers": []
|
||||||
|
},
|
||||||
|
"BuildSettings": {
|
||||||
|
"ProjectType": "library",
|
||||||
|
"SourcePath": "",
|
||||||
|
"OutputPath": "../../dist",
|
||||||
|
"Main": "cpl_discord.main",
|
||||||
|
"EntryPoint": "cpl-discord",
|
||||||
|
"IncludePackageData": false,
|
||||||
|
"Included": [],
|
||||||
|
"Excluded": [
|
||||||
|
"*/__pycache__",
|
||||||
|
"*/logs",
|
||||||
|
"*/tests"
|
||||||
|
],
|
||||||
|
"PackageData": {},
|
||||||
|
"ProjectReferences": []
|
||||||
|
}
|
||||||
|
}
|
0
src/cpl_discord/events/__init__.py
Normal file
0
src/cpl_discord/events/__init__.py
Normal file
0
src/cpl_discord/service/__init__.py
Normal file
0
src/cpl_discord/service/__init__.py
Normal file
16
src/cpl_discord/service/bot_service_abc.py
Normal file
16
src/cpl_discord/service/bot_service_abc.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
from abc import ABC, abstractmethod
|
||||||
|
|
||||||
|
import discord
|
||||||
|
from discord.ext import commands
|
||||||
|
|
||||||
|
|
||||||
|
class BotServiceABC(ABC, commands.Bot):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
ABC.__init__(self)
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
async def start_async(self): pass
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
async def stop_async(self): pass
|
Loading…
Reference in New Issue
Block a user