!wiki: give link to main page if no arguments are provided, catch timeout errors
This commit is contained in:
parent
c62ab1795c
commit
da63bf21f7
@ -6591,7 +6591,17 @@ def get_help(cli, rnick, chan, rest):
|
||||
@cmd("wiki", pm=True)
|
||||
def wiki(cli, nick, chan, rest):
|
||||
"""Prints information on roles from the wiki."""
|
||||
|
||||
# no arguments, just print a link to the wiki
|
||||
if not rest:
|
||||
cli.msg(chan, "https://github.com/lykoss/lykos/wiki")
|
||||
return
|
||||
|
||||
try:
|
||||
page = urllib.request.urlopen("https://raw.githubusercontent.com/wiki/lykoss/lykos/Home.md", timeout=2).read().decode('ascii', errors='replace')
|
||||
except urllib.error.URLError:
|
||||
cli.notice(nick, "Request to https://github.com/lykoss/lykos/wiki timed out.")
|
||||
return
|
||||
if not page:
|
||||
cli.notice(nick, "Could not open https://github.com/lykoss/lykos/wiki")
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user