commit
f62375eaed
|
|
@ -100,3 +100,12 @@ anthonywritescodebot: cool_user has been following for 3 hours!
|
||||||
some_user: !followage another_user
|
some_user: !followage another_user
|
||||||
anthonywritescodebot: another_user has been following for 5 years!
|
anthonywritescodebot: another_user has been following for 5 years!
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### `!joke`
|
||||||
|
|
||||||
|
Get a joke
|
||||||
|
|
||||||
|
```
|
||||||
|
anthonywritescode: !joke
|
||||||
|
anthonywritescodebot: The best thing about a Boolean is even if you are wrong, you are only off by a bit.
|
||||||
|
```
|
||||||
|
|
|
||||||
6
bot.py
6
bot.py
|
|
@ -25,6 +25,7 @@ from typing import Tuple
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import aiosqlite
|
import aiosqlite
|
||||||
import async_lru
|
import async_lru
|
||||||
|
import pyjokes
|
||||||
from humanize import naturaldelta
|
from humanize import naturaldelta
|
||||||
|
|
||||||
# TODO: allow host / port to be configurable
|
# TODO: allow host / port to be configurable
|
||||||
|
|
@ -507,6 +508,11 @@ def cmd_pep(match: Match[str]) -> Response:
|
||||||
return MessageResponse(match, f'https://www.python.org/dev/peps/pep-{n}/')
|
return MessageResponse(match, f'https://www.python.org/dev/peps/pep-{n}/')
|
||||||
|
|
||||||
|
|
||||||
|
@handle_message('!joke')
|
||||||
|
def cmd_joke(match: Match[str]) -> Response:
|
||||||
|
return MessageResponse(match, esc(pyjokes.get_joke()))
|
||||||
|
|
||||||
|
|
||||||
COMMAND_RE = re.compile(r'!\w+')
|
COMMAND_RE = re.compile(r'!\w+')
|
||||||
SECRET_CMDS = frozenset(('!settoday',))
|
SECRET_CMDS = frozenset(('!settoday',))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,3 +2,4 @@ aiohttp
|
||||||
aiosqlite
|
aiosqlite
|
||||||
async-lru
|
async-lru
|
||||||
humanize
|
humanize
|
||||||
|
pyjokes
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue