mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-27 18:45:05 +08:00
Add scheduler
This commit is contained in:
parent
7da292e13b
commit
e1210c4e5e
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,5 +1,3 @@
|
|||||||
.idea
|
.idea
|
||||||
*.iml
|
*.iml
|
||||||
.DS_Store
|
|
||||||
*.db
|
|
||||||
data
|
data
|
||||||
|
@ -10,7 +10,10 @@ class ApiClient:
|
|||||||
return newclient
|
return newclient
|
||||||
|
|
||||||
def __call__(self, *args, **kwargs):
|
def __call__(self, *args, **kwargs):
|
||||||
return requests.get(self.url, params=kwargs)
|
try:
|
||||||
|
return requests.get(self.url, params=kwargs)
|
||||||
|
except requests.exceptions.ConnectionError:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
client = ApiClient('http://127.0.0.1:5000/openqq')
|
client = ApiClient('http://127.0.0.1:5000/openqq')
|
||||||
|
4
app.py
4
app.py
@ -91,7 +91,7 @@ def _index():
|
|||||||
return '', 204
|
return '', 204
|
||||||
|
|
||||||
|
|
||||||
def load_commands():
|
def _load_commands():
|
||||||
command_mod_files = filter(
|
command_mod_files = filter(
|
||||||
lambda filename: filename.endswith('.py') and not filename.startswith('_'),
|
lambda filename: filename.endswith('.py') and not filename.startswith('_'),
|
||||||
os.listdir(get_commands_dir())
|
os.listdir(get_commands_dir())
|
||||||
@ -106,5 +106,5 @@ def load_commands():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
load_commands()
|
_load_commands()
|
||||||
app.run(host='127.0.0.1', port=8888)
|
app.run(host='127.0.0.1', port=8888)
|
||||||
|
@ -7,15 +7,15 @@ from little_shit import SkipException, get_command_name_separators
|
|||||||
_command_name_seps = get_command_name_separators()
|
_command_name_seps = get_command_name_separators()
|
||||||
|
|
||||||
|
|
||||||
class CommandNotExistsError(BaseException):
|
class CommandNotExistsError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class CommandPermissionError(BaseException):
|
class CommandPermissionError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class CommandScopeError(BaseException):
|
class CommandScopeError(Exception):
|
||||||
def __init__(self, msg_type):
|
def __init__(self, msg_type):
|
||||||
self.msg_type = msg_type
|
self.msg_type = msg_type
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ import os
|
|||||||
from config import config
|
from config import config
|
||||||
|
|
||||||
|
|
||||||
class SkipException(BaseException):
|
class SkipException(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ def get_db_dir():
|
|||||||
|
|
||||||
|
|
||||||
def get_default_db_path():
|
def get_default_db_path():
|
||||||
return os.path.join(get_db_dir(), 'default.db')
|
return os.path.join(get_db_dir(), 'default.sqlite')
|
||||||
|
|
||||||
|
|
||||||
def get_tmp_dir():
|
def get_tmp_dir():
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
apscheduler
|
||||||
requests
|
requests
|
||||||
cachetools
|
cachetools
|
||||||
pytz
|
pytz
|
||||||
|
Loading…
Reference in New Issue
Block a user