Archived
1
0
Fork 0
This repository has been archived on 2024-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
akari-bot/bug/__init__.py

26 lines
947 B
Python
Raw Normal View History

2020-06-13 12:43:43 +00:00
from .bugtracker import bug
from .bugtrackerbc import bugcb
from .bugtrackergc import buggc
import re
async def bugtracker(name):
try:
if name.find(" -h") != -1:
return('''~bug <JiraID> - 从Mojira中获取此Bug的信息。
[-b] - 使用百度翻译
[-g] - 使用Google翻译''')
elif name.find(" -g") != -1:
name = re.sub(' -g','',name)
q = re.match(r'^bug (.*\-.*)', name)
return (await buggc(q.group(1)))
elif name.find(" -b") != -1:
name = re.sub(' -b', '', name)
q = re.match(r'^bug (.*\-.*)', name)
return (await bugcb(q.group(1)))
else:
try:
q = re.match(r'^bug (.*)\-(.*)', name)
return(bug(q.group(1)+'-'+q.group(2)))
except Exception:
return ('未知语法,请使用~bug -h获取帮助。')
except Exception:
return (str(e))