Merge pull request #6 from yoavcaspi/add_discord

Adding !discord command.
This commit is contained in:
Anthony Sottile 2019-06-08 13:38:04 -07:00 committed by GitHub
commit 2fcef759e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -74,3 +74,12 @@ anthonywritescodebot: PONG
anthonywritescode: PING hello anthonywritescode: PING hello
anthonywritescodebot: PONG hello anthonywritescodebot: PONG hello
``` ```
### `!discord'
Show the discord url
```
anthonywritescode: !discord
anthonywritescodebot: We do have Discord, you are welcome to join: https://discord.gg/HxpQ3px
```

5
bot.py
View File

@ -124,6 +124,11 @@ def cmd_ohai(match: Match[str]) -> Response:
return MessageResponse(match, 'ohai, {user}!') return MessageResponse(match, 'ohai, {user}!')
@handle_message('!discord')
def cmd_discord(match: Match[str]) -> Response:
return MessageResponse(match, 'We do have Discord, you are welcome to join: https://discord.gg/HxpQ3px')
class UptimeResponse(Response): class UptimeResponse(Response):
async def __call__(self, config: Config) -> Optional[str]: async def __call__(self, config: Config) -> Optional[str]:
url = f'https://api.twitch.tv/helix/streams?user_login={config.channel}' # noqa: E501 url = f'https://api.twitch.tv/helix/streams?user_login={config.channel}' # noqa: E501