bot: clean

This commit is contained in:
dece 2020-10-09 22:34:32 +02:00
parent f4e884e9d7
commit 5ed9d2f3ce
4 changed files with 25 additions and 20 deletions

View file

@ -6,7 +6,7 @@ verify_ssl = true
[dev-packages] [dev-packages]
[packages] [packages]
irc = "~=19.0.1" irc = "*"
requests = "*" requests = "*"
[requires] [requires]

14
Pipfile.lock generated
View file

@ -1,7 +1,7 @@
{ {
"_meta": { "_meta": {
"hash": { "hash": {
"sha256": "024a36b2b9e61302df7560d7af32ef1c9802327f23381e327cacb345adf56eb7" "sha256": "b9ea2a09600a7aba7d67761e0e8338ba3711a93442f9be86e950621b70be216f"
}, },
"pipfile-spec": 6, "pipfile-spec": 6,
"requires": { "requires": {
@ -35,7 +35,6 @@
"sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6", "sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6",
"sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0" "sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"
], ],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==2.10" "version": "==2.10"
}, },
"importlib-metadata": { "importlib-metadata": {
@ -59,7 +58,6 @@
"sha256:116429c2047953f525afdcae165475c4589c7b14870e78b2d068ecb01018827e", "sha256:116429c2047953f525afdcae165475c4589c7b14870e78b2d068ecb01018827e",
"sha256:c38698ff8ef932eb33d91c0e8fc192ad7c44ecee03f7f585afd4f35aeaef7aab" "sha256:c38698ff8ef932eb33d91c0e8fc192ad7c44ecee03f7f585afd4f35aeaef7aab"
], ],
"markers": "python_version >= '3.6'",
"version": "==3.1.0" "version": "==3.1.0"
}, },
"jaraco.collections": { "jaraco.collections": {
@ -67,7 +65,6 @@
"sha256:a7889f28c80c4875bd6256d9924e8526dacfef22cd7b80ff8469b4d312f9f144", "sha256:a7889f28c80c4875bd6256d9924e8526dacfef22cd7b80ff8469b4d312f9f144",
"sha256:be570ef4f2e7290b757449395238fa63d70a9255574624e73c5ff9f1ee554721" "sha256:be570ef4f2e7290b757449395238fa63d70a9255574624e73c5ff9f1ee554721"
], ],
"markers": "python_version >= '3.6'",
"version": "==3.0.0" "version": "==3.0.0"
}, },
"jaraco.functools": { "jaraco.functools": {
@ -75,7 +72,6 @@
"sha256:9fedc4be3117512ca3e03e1b2ffa7a6a6ffa589bfb7d02bfb324e55d493b94f4", "sha256:9fedc4be3117512ca3e03e1b2ffa7a6a6ffa589bfb7d02bfb324e55d493b94f4",
"sha256:d3dc9f6c1a1d45d7f59682a3bf77aceb685c1a60891606c7e4161e72ecc399ad" "sha256:d3dc9f6c1a1d45d7f59682a3bf77aceb685c1a60891606c7e4161e72ecc399ad"
], ],
"markers": "python_version >= '3.6'",
"version": "==3.0.1" "version": "==3.0.1"
}, },
"jaraco.logging": { "jaraco.logging": {
@ -83,7 +79,6 @@
"sha256:31716fe84d3d5df39d95572942513bd4bf8ae0a478f64031eff4c2ea9e83434e", "sha256:31716fe84d3d5df39d95572942513bd4bf8ae0a478f64031eff4c2ea9e83434e",
"sha256:b05ed07101883997a30e05c2472798d86129803d9961a0d1081a3236ad37c52a" "sha256:b05ed07101883997a30e05c2472798d86129803d9961a0d1081a3236ad37c52a"
], ],
"markers": "python_version >= '3.6'",
"version": "==3.0.0" "version": "==3.0.0"
}, },
"jaraco.stream": { "jaraco.stream": {
@ -91,7 +86,6 @@
"sha256:287e1cba9f278e0146fdded6bc40518930813a5584579769aeaa1d0bfd178a73", "sha256:287e1cba9f278e0146fdded6bc40518930813a5584579769aeaa1d0bfd178a73",
"sha256:a42357141288bbd55938b9ff464173c078038374ce5ffa1bf31895138acc0f30" "sha256:a42357141288bbd55938b9ff464173c078038374ce5ffa1bf31895138acc0f30"
], ],
"markers": "python_version >= '3.6'",
"version": "==3.0.0" "version": "==3.0.0"
}, },
"jaraco.text": { "jaraco.text": {
@ -99,7 +93,6 @@
"sha256:c87569c9afae14f71b2e1c57f316770ab6981ab675d9c602be1c7981161bacdd", "sha256:c87569c9afae14f71b2e1c57f316770ab6981ab675d9c602be1c7981161bacdd",
"sha256:e5078b1126cc0f166c7859aa75103a56c0d0f39ebcafc21695615472e0f810ec" "sha256:e5078b1126cc0f166c7859aa75103a56c0d0f39ebcafc21695615472e0f810ec"
], ],
"markers": "python_version >= '2.7'",
"version": "==3.2.0" "version": "==3.2.0"
}, },
"more-itertools": { "more-itertools": {
@ -107,7 +100,6 @@
"sha256:6f83822ae94818eae2612063a5101a7311e68ae8002005b5e05f03fd74a86a20", "sha256:6f83822ae94818eae2612063a5101a7311e68ae8002005b5e05f03fd74a86a20",
"sha256:9b30f12df9393f0d28af9210ff8efe48d10c94f73e5daf886f10c4b0b0b4f03c" "sha256:9b30f12df9393f0d28af9210ff8efe48d10c94f73e5daf886f10c4b0b0b4f03c"
], ],
"markers": "python_version >= '3.5'",
"version": "==8.5.0" "version": "==8.5.0"
}, },
"pytz": { "pytz": {
@ -130,7 +122,6 @@
"sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259", "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259",
"sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced" "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"
], ],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==1.15.0" "version": "==1.15.0"
}, },
"tempora": { "tempora": {
@ -138,7 +129,6 @@
"sha256:599a3a910b377f2b544c7b221582ecf4cb049b017c994b37f2b1a9ed1099716e", "sha256:599a3a910b377f2b544c7b221582ecf4cb049b017c994b37f2b1a9ed1099716e",
"sha256:9f46de767be7dd21d9602a8a5b0978fd55abc70af3e2a7814c85c00d7a8fffa3" "sha256:9f46de767be7dd21d9602a8a5b0978fd55abc70af3e2a7814c85c00d7a8fffa3"
], ],
"markers": "python_version >= '3.6'",
"version": "==4.0.0" "version": "==4.0.0"
}, },
"urllib3": { "urllib3": {
@ -146,7 +136,6 @@
"sha256:91056c15fa70756691db97756772bb1eb9678fa585d9184f24534b100dc60f4a", "sha256:91056c15fa70756691db97756772bb1eb9678fa585d9184f24534b100dc60f4a",
"sha256:e7983572181f5e1522d9c98453462384ee92a0be7fac5f1413a1e35c56cc0461" "sha256:e7983572181f5e1522d9c98453462384ee92a0be7fac5f1413a1e35c56cc0461"
], ],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'",
"version": "==1.25.10" "version": "==1.25.10"
}, },
"zipp": { "zipp": {
@ -154,7 +143,6 @@
"sha256:64ad89efee774d1897a58607895d80789c59778ea02185dd846ac38394a8642b", "sha256:64ad89efee774d1897a58607895d80789c59778ea02185dd846ac38394a8642b",
"sha256:eed8ec0b8d1416b2ca33516a37a08892442f3954dee131e92cfd92d8fe3e7066" "sha256:eed8ec0b8d1416b2ca33516a37a08892442f3954dee131e92cfd92d8fe3e7066"
], ],
"markers": "python_version >= '3.6'",
"version": "==3.3.0" "version": "==3.3.0"
} }
}, },

View file

@ -5,16 +5,33 @@ New version of the infamous IRC bot.
Installation
------------
Clone the repository and install main dependencies using Pipenv:
```bash
pipenv install
```
Plugins dependencies can be manually installed with
```bash
pipenv run pip install -r edmond/plugins/requirements.txt
```
Missing features Missing features
---------------- ----------------
- [x] Actions (/me) - [x] Actions (/me)
- [x] Beers - [x] Beers
- [x] Mood - [x] Mood
- [ ] Random: dice, choice, etc - [x] Random: ~~dice~~, choice, etc
- [ ] Notes - [ ] Notes
- [ ] Handle compliments - [ ] Handle compliments
- [ ] Handle - [ ] Handle insults
- [x] Horoscope - [x] Horoscope
- [x] "Journee mondiale" - [x] "Journee mondiale"
- [ ] Mug - [ ] Mug

View file

@ -9,8 +9,8 @@ class Plugin:
def __init__(self, bot): def __init__(self, bot):
self.bot = bot self.bot = bot
self.name = self.__class__.__name__.lower()[:-6] # Remove "Plugin". self.name = self.__class__.__name__.lower()[:-6] # Remove "Plugin".
self.config = self.get_config() self.config = self._get_config()
self.is_ready = self.check_config() self.is_ready = self._check_config()
@property @property
def callbacks(self): def callbacks(self):
@ -21,7 +21,7 @@ class Plugin:
if cb.startswith("on_") and callable(getattr(self, cb)) if cb.startswith("on_") and callable(getattr(self, cb))
} }
def get_config(self): def _get_config(self):
"""Return the plugin section from the bot config, plus common values.""" """Return the plugin section from the bot config, plus common values."""
plugins_configs = self.bot.config["plugins"] plugins_configs = self.bot.config["plugins"]
config = plugins_configs["common"].copy() config = plugins_configs["common"].copy()
@ -37,7 +37,7 @@ class Plugin:
self.bot.log_e(f"Could not load resource at {resource_path}.") self.bot.log_e(f"Could not load resource at {resource_path}.")
return config return config
def check_config(self): def _check_config(self):
"""Return True if the plugin config is properly setup.""" """Return True if the plugin config is properly setup."""
missing = False missing = False
for key in self.REQUIRED_CONFIGS: for key in self.REQUIRED_CONFIGS: