-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
84 lines (73 loc) · 3.87 KB
/
bot.py
File metadata and controls
84 lines (73 loc) · 3.87 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import os
import json
import discord
from discord.ext import commands
import requests
from dotenv import load_dotenv
load_dotenv()
TOKEN = os.getenv("DISCORD_TOKEN")
client = commands.Bot(command_prefix='$')
URL ="https://remedious-api.herokuapp.com/"
request = requests.get(URL + "dashboard",headers={
"email":"email4",
"password":"123"
})
json_response = request.json()
symptons_list = json_response['Symptoms Details']
remedy_list = json_response['Remedy Details']
@client.command()
async def FAQ(ctx):
embedVar = discord.Embed(title="Commonly Asked Questions", description="called by "+ctx.author.mention, color=0x115ad1)
embedVar.add_field(name="What is Remedious?", value="Remedious is a platform where you can get information about treatments and remedies for common symptoms related to COVID-19", inline=False)
embedVar.add_field(name="What is ‘Long Covid’?", value ="Long Covid describes a set of symptoms that continue long after the initial Covid-19 infection has gone. Even people who had relatively moderate Covid-19 at the time can experience long covid symptoms. So can young, fit people.", inline=False)
embedVar.add_field(name="What are the effects of Long Covid?", value="You don't have to be admitted to hospital with Covid-19 to have Long Covid but one British Medical Journal paper looked at what happened to those who were admitted (about 450,000 of them) after they were discharged. All told, one third of discharged patients were readmitted to hospital and one in 10 died.", inline=False)
embedVar.add_field(name="What are some symptoms of Long Covid?", value="Run `$symptoms` to see a full list", inline=False)
embedVar.add_field(name="What are some remedies I can follow?", value="Run `$remedies` to see a full list", inline=False)
await ctx.send(embed = embedVar)
@client.command()
async def symptoms(ctx):
embedVar = discord.Embed(title="Symptoms on Remedious",description="called by "+ctx.author.mention, color=0x115ad1)
for i in range(len(symptons_list)):
embedVar.add_field(name=symptons_list[i]['symptoms'], value="level = "+symptons_list[i]['level'], inline=False)
await ctx.send(embed=embedVar)
@client.command()
async def remedies(ctx):
embedVar = discord.Embed(title="Remedies on Remedious",description="called by "+ctx.author.mention, color=0x115ad1)
for i in range(len(remedy_list)):
embedVar.add_field(name=remedy_list[i]['name'], value="level = "+ remedy_list[i]['level'],inline=False)
await ctx.send(embed=embedVar)
@client.command()
async def remedy(ctx,*,rem):
for i in range(len(remedy_list)):
if remedy_list[i]['name']==rem:
index = i
break
try:
remedy = remedy_list[index]
embedVar = discord.Embed(title=rem,description="called by "+ctx.author.mention, color=0x115ad1)
embedVar.add_field(name = "Name",value=rem)
embedVar.add_field(name = "Frequency", value=remedy['frequency'])
embedVar.add_field(name = "Level", value=remedy['level'])
embedVar.add_field(name = "Amount", value=remedy['amount'])
embedVar.add_field(name = "Symptom Frequency", value=remedy['symptom_frequency'])
except:
await ctx.send("Invalid remedy")
return
await ctx.send(embed=embedVar)
@client.command()
async def sympton(ctx,*,symp):
for i in range(len(symptons_list)):
if symptons_list[i]['symptoms']==symp:
index = i
break
try:
symp_data = symptons_list[index]
embedVar = discord.Embed(title=symp,description="called by "+ctx.author.mention, color=0x115ad1)
embedVar.add_field(name = "Name",value=symp)
embedVar.add_field(name = "Frequency", value=symp_data['frequency'])
embedVar.add_field(name = "Level", value=symp_data['level'])
except:
await ctx.send("Invalid sympton")
return
await ctx.send(embed=embedVar)
client.run(TOKEN)