Compare commits

..

3 Commits

2 changed files with 58 additions and 2 deletions

56
README.md Normal file
View File

@@ -0,0 +1,56 @@
maidbot
====
A bot program for fediverse.
## CONFIGURATION
Create `config.json` like below.
```json
{
"logging" : "DEBUG",
"instance": "falsy.cat",
"username": "maidbot",
"password": "helloworld",
"master" : "user ID of the master (not username)",
"interval": "interval seconds of a single cycle",
"mods": {
"MODNAME": {
"key": "param"
}
}
}
```
You can enable a mod by inserting new item to the `mods`.
## MODS
I'll add new one when I need.
### elicense
**THIS MOD MAY CAUSE YOU A CANCELLALATION FEE BY UNEXPECTED BEHAVIOUR BUT I DON'T TAKE ANY RESPONSIBILITY**
This mod can make a reservation through elicense.jp.
To enable this mod, insert the below object into the `mods`.
Now you can say `@maidbot watch 19900101 1 2 3 4` to make a reservation on one of periods from 1 to 4 on 1990/01/01.
```json
"elicense": {
"logging" : "INFO",
"school" : "school ID",
"username": "username",
"password": "password"
}
```
## LICENSE
WTFPLv2

View File

@@ -7,7 +7,6 @@ import requests
def init(CONFIG, logger): def init(CONFIG, logger):
logger.setLevel(logging.DEBUG)
return Mod(CONFIG, logger) return Mod(CONFIG, logger)
@@ -119,6 +118,7 @@ class Calender:
raise Exception(m[1]) raise Exception(m[1])
self.avails = re.findall(RE_AVAIL_SLOT, text) self.avails = re.findall(RE_AVAIL_SLOT, text)
print(self.avails)
self.params = {} self.params = {}
for name in RE_PARAMS: for name in RE_PARAMS:
@@ -148,7 +148,7 @@ TIMETABLE = {
RE_ALERT = re.compile(r"window\.alert\('(.*)'\)") RE_ALERT = re.compile(r"window\.alert\('(.*)'\)")
RE_ERROR = re.compile(r"<.*? class=\"errorTitle\">メッセージ<\/.*?>\s*<.*? class=\"errorDisp\">(.*?)<\/.*?>", re.MULTILINE) RE_ERROR = re.compile(r"<.*? class=\"errorTitle\">メッセージ<\/.*?>\s*<.*? class=\"errorDisp\">(.*?)<\/.*?>", re.MULTILINE)
RE_AVAIL_SLOT = re.compile(r"^\s*<a href=\"#\" onclick=\"sendContent\('(\d+)','(\d+)','V',document\.getElementById\('formId'\)\)\">$") RE_AVAIL_SLOT = re.compile(r"<a href=\"#\" onclick=\"sendContent\('(\d+)','(\d+)','V',document\.getElementById\('formId'\)\)\">")
RE_PARAMS = { RE_PARAMS = {
"kamokuCd" : None, "kamokuCd" : None,