-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
37 lines (25 loc) · 784 Bytes
/
bot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import discord
import requests
import json
import os
from dotenv import load_dotenv
load_dotenv()
def get_call(req):
response = requests.get('https://vlrggapi.herokuapp.com/news')
jsonData = json.loads(response.text)
return jsonData['data']['segments'][0]['description']
client = discord.Client()
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content == ('/news'):
msg = get_call('/news')
await message.channel.send(msg)
if message.content == ('/matches/results'):
msg = get_call('/matches/results')
await message.channel.send(msg)
client.run(os.getenv('TOKEN'))