Coder Social home page Coder Social logo

picklejason / coronavirus-bot Goto Github PK

View Code? Open in Web Editor NEW
41.0 3.0 24.0 88 KB

Discord Bot for info on novel coronavirus (COVID-19)

License: GNU General Public License v3.0

Python 100.00%
coronavirus-tracking coronavirus-info coronavirus-bot covid-19 covid-virus covid19 discord-bot stats discord-py discordbot reddit 2019-ncov

coronavirus-bot's Introduction

ko-fi

Discord Bots

Coronavirus Bot

This is a Discord bot coded in Python with discord.py for providing info on the novel coronavirus (COVID-19) by picklejason.

Current features include stats showing total confirmed, deaths, and recovered cases. A graph (linear or log) is also displayed showing confirmed cases and deaths from late January to current day. In addition, the bot also can retrieve posts from the subreddit r/Coronavirus.

Data for the stats and graph are from Worldometer and Johns Hopkins CSSE

Usage

  • Invite the bot to your server using the following link: invite

  • The command prefix for the bot is .c or @mention

  • Use the help command for further info

Features

  • React with ๐Ÿ“ˆ for a linear graph or ๐Ÿ“‰ for a log graph

  • .c stat all Stats of all locations

  • .c stat <country name> Stats of a specific country

  • .c stat <US> <state> Stats of a specific state in the United States

  • .c reddit [category] Reddit posts from r/Coronavirus | category = Hot New Top | Use โฌ…๏ธ and โžก๏ธ to scroll through

coronavirus-bot's People

Contributors

picklejason avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

coronavirus-bot's Issues

Suggestion: log scale option

I would very much enjoy to be able to pass "-log" or something and get a log-linear plot with number of cases log.

Feature request : growth factor value

Hi,
In the understanding to how the epidemic is faring, having the number of case growth factor would permit to give a bit of hope to people, which would be good in these time of self isolation.

Could you include it at the top near the number of new confirmed case?

Thanks for reading.

Bot Offline

Did we offend the bot? He is offline. Can't hail him/her/they. =)

Screen Shot 2020-05-07 at 1 28 47 PM

No Graph

First, this is a great little bot. Thank you for making it. It seems I have it up and running but I am not getting any graphs. Here's what I am seeing:

Screen Shot 2020-03-21 at 2 50 28 PM

Google

Thanks for making this.
Is there a way to run this Bot locally without Google cloud?

Use API instead of GitHub files

The files on CSSEGISandData/COVID-19 are updated once a day.

More often updates are pushed to their API.

ExpDev07/coronavirus-tracker-api scrapes that data and caches them for an hour so that would mean you'd get hourly updates instead of daily.

For easier integration into Python projects, check out Kamaropoulos/COVID19Py, a wrapper I made for that API which makes it just a matter of instantiating an object and taking the data.

For example:

import COVID19Py
covid19 = COVID19Py.COVID19()
print(covid19.getLatest())

would give you:

{
    "confirmed": 214910,
    "deaths": 8733,
    "recovered": 83207
}

for the latest global stats.

You can also filter by country and get all the timelines for each region.

Think you could find it useful, check it out!

Self host broken

Hello, I seem to be getting an error trying to run your bot because you won't get it verified!

the error I am getting is:

`G:\coronavirus-bot-2.5>py covid-19.py
Help.py loaded successfully
Reddit.py loaded successfully
Stats.py failed to load
TopGG.py failed to load
C:\Users\brade\AppData\Local\Programs\Python\Python310\lib\site-packages\aiohttp\connector.py:964: RuntimeWarning: coroutine 'TCPConnector._resolve_host' was never awaited
hosts = await asyncio.shield(self._resolve_host(
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Traceback (most recent call last):
File "G:\coronavirus-bot-2.5\covid-19.py", line 87, in
bot.run(config.token)
File "C:\Users\brade\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 723, in run
return future.result()
File "C:\Users\brade\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 702, in runner
await self.start(*args, **kwargs)
File "C:\Users\brade\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 665, in start
await self.login(*args, bot=bot)
File "C:\Users\brade\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 511, in login
await self.http.static_login(token.strip(), bot=bot)
File "C:\Users\brade\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 300, in static_login
data = await self.request(Route('GET', '/users/@me'))
File "C:\Users\brade\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 192, in request
async with self.__session.request(method, url, **kwargs) as r:
File "C:\Users\brade\AppData\Local\Programs\Python\Python310\lib\site-packages\aiohttp\client.py", line 1012, in aenter
self._resp = await self._coro
File "C:\Users\brade\AppData\Local\Programs\Python\Python310\lib\site-packages\aiohttp\client.py", line 480, in _request
conn = await self._connector.connect(
File "C:\Users\brade\AppData\Local\Programs\Python\Python310\lib\site-packages\aiohttp\connector.py", line 523, in connect
proto = await self._create_connection(req, traces, timeout)
File "C:\Users\brade\AppData\Local\Programs\Python\Python310\lib\site-packages\aiohttp\connector.py", line 858, in _create_connection
_, proto = await self._create_direct_connection(
File "C:\Users\brade\AppData\Local\Programs\Python\Python310\lib\site-packages\aiohttp\connector.py", line 964, in _create_direct_connection
hosts = await asyncio.shield(self._resolve_host(
TypeError: shield() got an unexpected keyword argument 'loop'

G:\coronavirus-bot-2.5>`

I don't know what I'm doing wrong the config has my token and I removed the google logging and replaced with print()

I did the following for install:
pip install -r requirements.txt
and created a config.py with a value of
token='my token'
and then did
py covid-19.py
and then that error showed.

am I doing something wrong?

suggestion: Add the ability to disable the bot in specific channels

Create a command that allows server managers to disable the coronavirus bot in certain channels. This is useful to servers that may wish to confine coronavirus chat to certain channels, especially in support/venting servers where there are vulnerable people that may be triggered by the topic.

Stats down

Other commands seem to be working fine but no .c stat has been working since I tried an hour ago.

Data not showing for The Netherlands

Hello,

The data for the Netherlands is not showing. I have tried every option for the bot that should work with the Netherlands from NL to ISO code but I keep having an error... maybe a bug? :) Hope you could look into it because we really want to use it in our school discord server :)

Screenshot_14

Self Hosting

Hi, appreciate the code here. Is there a way to self host this bot? I have had some experience with hosting bots, and I want to try self hosting. I will only be using this bot for my own server, and I won't advertise it, or anything like that. thanks

Keep the sources

My 2 cents. Take it with a grain of salt

Sources are incredibly important in this time period. You loose credibility when sources are not tagged. More important than issue/suggestions IMHO. Do not replace the sources in the footer with issues/suggestions.

I would put the sources back immediately. Keep the issues/suggestion if you want, too.

Screen Shot 2020-03-27 at 8 57 58 AM

  • Data from Worldometer and Johns Hopkins CSSE

Lost data for NJ

Although this was working yesterday, it's not today.

.c stat us nj

Screen Shot 2020-03-24 at 8 28 08 AM

UK stat isn't consistent

Hi, I noticed there is inconsistency with UK graph and the top the data.
image

As you can see the recovered plot has been increasing. However, UK recovered data has been 135 for past few days.

I took a look at /cogs/Stats.py and I saw that top data gives out worldometer data, which is UK only. but the plot shows the sum of UK data and UK overseas overseas territories.

error

error coming :

C:\Users\TEST\Downloads\coronavirus-bot-master>python covid-19.py
Traceback (most recent call last):
File "covid-19.py", line 13, in
logging_client = google.cloud.logging.Client()
File "C:\Python38\lib\site-packages\google\cloud\logging\client.py", line 126, in init
super(Client, self).init(
File "C:\Python38\lib\site-packages\google\cloud\client.py", line 226, in init
_ClientProjectMixin.init(self, project=project)
File "C:\Python38\lib\site-packages\google\cloud\client.py", line 178, in init
project = self._determine_default(project)
File "C:\Python38\lib\site-packages\google\cloud\client.py", line 193, in _determine_default
return _determine_default_project(project)
File "C:\Python38\lib\site-packages\google\cloud_helpers.py", line 186, in _determine_default_project
_, project = google.auth.default()
File "C:\Python38\lib\site-packages\google\auth_default.py", line 333, in default
raise exceptions.DefaultCredentialsError(_HELP_MESSAGE)
google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or explicitly create credentials and re-run the application. For more information, please see https://cloud.google.com/docs/authentication/getting-started

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.