Skip to content
This repository was archived by the owner on Mar 14, 2021. It is now read-only.

Team 13 #10

Open
wants to merge 54 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
0aa95cb
Merge pull request #1 from discord-python/master
schwartzadev Mar 23, 2018
c2505ce
add preliminary snake 'get' command
schwartzadev Mar 23, 2018
8c25449
allow user input for snake names
schwartzadev Mar 23, 2018
e3f0c70
change imports order, index format string
schwartzadev Mar 23, 2018
611501f
add interim fancy message formatting, handle special python case
schwartzadev Mar 23, 2018
85bb282
add snake to query string for images
schwartzadev Mar 23, 2018
243b51f
add list of snake facts, sources files
schwartzadev Mar 24, 2018
b4e6468
update sources
schwartzadev Mar 24, 2018
cea4cf3
add snake fact command
schwartzadev Mar 24, 2018
3a37252
clean up code - type hinting, spelling, URL formatting, etc. (thanks …
schwartzadev Mar 24, 2018
6602d02
fix broken URL
schwartzadev Mar 24, 2018
62401e5
resolve PEP E226
schwartzadev Mar 24, 2018
7f63f4f
implement more of @1mn's suggestions
schwartzadev Mar 24, 2018
0137051
use the snake emoji
schwartzadev Mar 24, 2018
1e710db
integrate with the API - thanks @prithajnath - remove message from re…
schwartzadev Mar 24, 2018
5844b02
Merge pull request #2 from discord-python/master
schwartzadev Mar 24, 2018
3656c01
Add search endpoint and auth headers
prithajnath Mar 24, 2018
48f8de4
Merge pull request #3 from discord-python/master
schwartzadev Mar 25, 2018
bf2f9ea
remove repetitive embed code, fix linting errors (hopefully!)
schwartzadev Mar 25, 2018
d8a26ba
resolve flake8 - P103
schwartzadev Mar 25, 2018
9c8a9f4
resolve linting issues
schwartzadev Mar 25, 2018
697f557
implement random api endpoint
schwartzadev Mar 25, 2018
0951f92
implement titlecase for common and scientific names, remove unused al…
schwartzadev Mar 25, 2018
544bed5
return number of matches in searches, add handling of searches with 0…
schwartzadev Mar 25, 2018
a2255e7
add qwant api in favor of unsplash, including handling for small numb…
schwartzadev Mar 25, 2018
9b2f8d0
rm prints
schwartzadev Mar 25, 2018
f30abab
Merge pull request #4 from schwartzadev/qwant-images
schwartzadev Mar 25, 2018
48f2584
add newline between imports (I201) for linting
schwartzadev Mar 25, 2018
e5901b6
Add APIs used
prithajnath Mar 25, 2018
5770c79
Add some GIFs for facts
prithajnath Mar 25, 2018
259c5a6
linting updates
schwartzadev Mar 25, 2018
2d45b2f
add list of zen python sayings
schwartzadev Mar 25, 2018
6776264
use response.json() for qwant access
schwartzadev Mar 25, 2018
03f9b61
handle snakes without a location, reduce variance in photos to three …
schwartzadev Mar 25, 2018
a27582a
Add cat input for GIF
prithajnath Mar 25, 2018
e2d556b
start video command - needs formatting work for embed
schwartzadev Mar 25, 2018
003ace9
remove embed (Discord is finnicky), fix command format
schwartzadev Mar 25, 2018
2366c43
update docstring for get
schwartzadev Mar 25, 2018
ea31798
update video docstring
schwartzadev Mar 25, 2018
a9f8863
fix get_video_json docstring
schwartzadev Mar 25, 2018
01c701b
Add Zen of Python
prithajnath Mar 25, 2018
9d28fa3
Merge pull request #6 from schwartzadev/video-command
prithajnath Mar 25, 2018
c98bc6e
Merge branch 'master' into prithaj_gif_categories
schwartzadev Mar 25, 2018
d2482b2
Merge pull request #5 from schwartzadev/prithaj_gif_categories
schwartzadev Mar 25, 2018
f1b7a2c
Add alias for this
prithajnath Mar 25, 2018
ff361b8
Add descp for zen
prithajnath Mar 25, 2018
13937c1
Merge branch 'prithaj_zen_of_python' of https://github.com/schwartzad…
schwartzadev Mar 25, 2018
3279319
lint, fix spelling
schwartzadev Mar 25, 2018
e0d2bf2
lint, fix spelling
schwartzadev Mar 25, 2018
361cc45
Merge pull request #7 from schwartzadev/prithaj_zen_of_python
schwartzadev Mar 25, 2018
ac33379
Merge branch 'master' of https://github.com/schwartzadev/code-jam-1
schwartzadev Mar 25, 2018
375f4bc
fix arguments, lint, and format for get_snek_fact
schwartzadev Mar 25, 2018
71a0f44
linting
schwartzadev Mar 25, 2018
99f00f2
add information about credentials
schwartzadev Mar 26, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
[[source]]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's loads of extra spaces in this file now. Did you edit it by hand?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope - this happened automatically when I installed the titlecase package

url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"


[packages]

"72eb2aa" = {file = "https://github.com/Rapptz/discord.py/archive/rewrite.zip"}
aiodns = "*"
aiohttp = "<2.3.0,>=2.0.0"
websockets = ">=4.0,<5.0"
titlecase = "*"


[dev-packages]

"flake8" = "*"
"flake8-bugbear" = "*"
"flake8-bandit" = "*"
Expand All @@ -20,5 +26,7 @@ websockets = ">=4.0,<5.0"
safety = "*"
dodgy = "*"


[requires]

python_version = "3.6"
246 changes: 127 additions & 119 deletions Pipfile.lock

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@ This is the repository for all code relating to our first code jam, in March 201

**This code jam runs from the 23rd of March to the 25th of March, measured using the UTC timezone.** Make sure you open your pull request by then. Once the deadline is up, stop pushing commits - we will not accept any submissions made after this date.

## Credentials
In order to run this bot on your own, you will need a couple credentials, stored as environment variables. Since we are using `pipenv`, we are storing these in the `.env` file in the root directory.
Your .env should look like this:
```
BOT_TOKEN=bottoken
ACCESS_TOKEN=accesstoken
YOUTUBE_DATA_KEY=youtubekey
```
The `BOT_TOKEN` is the Discord token. Find how to obtain this [here](https://github.com/discord-python/code-jam-1/blob/master/doc/bot-setup.md).

The `ACCESS_TOKEN` is a token to access our data API. Get in touch with @prithajnath to receive a token.

The `YOUTUBE_DATA_KEY` is an API key from Google. Specifically, this uses the [YouTube Data API v3](https://console.developers.google.com/apis/credentials). Generate a key here, which will be associated with your Google account.

## APIs used
* [Qwant](https://www.qwant.com/) (for snake pics)
* [Our custom Snake API](https://github.com/prithajnath/snake) (scraped a page with bs4 and saved it in a db)


## How To Participate

First things first - set up your repository. Read [this guide on our site](https://pythondiscord.com/info/jams) for information on how to set yourself up for a code jam.
Expand Down
53 changes: 53 additions & 0 deletions bot/cogs/resources/facts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"facts": {
"Snakes are carnivores (meat eaters).":"dangerous",
"Snakes don’t have eyelids.":"interesting",
"Snakes can’t bite food so have to swallow it whole.":"dangerous",
"Snakes have flexible jaws which allow them to eat prey bigger than their head!":"dangerous",
"Snakes are found on every continent of the world except Antarctica.":"interesting",
"Snakes have internal ears but not external ones.":"interesting",
"Snakes used in snake charming performances respond to movement, not sound.":"interesting",
"There are around 3000 different species of snake.":"interesting",
"Snakes have a unique anatomy which allows them to swallow and digest large prey.":"dangerous",
"Snakes are covered in scales.":"interesting",
"Snakeskin is smooth and dry.":"interesting",
"Snakes shed their skin a number of times a year in a process that usually lasts a few days.":"interesting",
"Snakes smell with their tongue.":"interesting",
"Pythons kill their prey by tightly wrapping around it and suffocating it in a process called constriction.":"dangerous",
"Some sea snakes can breathe partially through their skin, allowing for longer dives underwater.":"interesting",
"Some animals, such as the Mongoose, are immune to snake venom.":"interesting",
"While snakes do not have external ears or eardrums, their skin, muscles, and bones carry sound vibrations to their inner ears.":"interesting",
"Rattlesnake rattles are made of rings of keratin, which is the same material as human hair and fingernails. A rattler will add a new ring each time it sheds its skin.":"interesting",
"Some snakes have over 200 teeth. The teeth aren’t used for chewing but they point backward to prevent prey from escaping the snake’s throat.":"interesting",
"There are five recognized species of flying snakes. Growing up to 4 feet, some types can glide up to 330 feet through the air.":"interesting",
"Snakes do not lap up water like mammals do. Instead, they dunk their snouts underwater and use their throats to pump water into their stomachs.":"interesting",
"A snake’s fangs usually last about 6–10 weeks. When a fang wears out, a new one grows in its place.":"interesting",
"Snakes typically need to eat only 6–30 meals each year to be healthy.":"interesting",
"If the temperature reaches below 50° Fahrenheit, a snake’s body does not work properly.":"interesting",
"The Gaboon viper has the longest fangs of any snake, reaching about 2 inches (5 cm) long.":"dangerous",
"The longest snake ever recorded is the reticulated python. It can reach over 33 feet long, which is big enough to swallow a pig, a deer, or even a person.":"dangerous",
"Some venomous snakes have died after biting and poisoning themselves by mistake.":"self-harm",
"While a snake cannot hear the music of a snake charmer, the snake responds to the vibrations of the charmer’s tapping foot or to the movement of the flute.":"interesting",
"Most snakes are not harmful to humans and they help balance the ecosystem by keeping the population of rats, mice, and birds under control.":"interesting",
"Most snakes have an elongated right lung, many have a smaller left lung, and a few even have a third lung. They do not have a sense of taste, and most of their organs are organized linearly.":"interesting",
"Snakes kill over 40,000 people a year—though, with unreported incidents, the total may be over 100,000. About half of these deaths are in India.":"dangerous",
"Some members of the U.S. Army Special Forces are taught to kill and eat snakes during their survival training, which has earned them the nickname “Snake Eaters.”":"dangerous"
},
"gifs":{
"dangerous":[
"https://media.giphy.com/media/2yP1jNgjNAkvu/giphy.gif",
"https://media.giphy.com/media/OGufyodtN4NUs/giphy.gif",
"https://media.giphy.com/media/tP2fZCu4K9Yac/giphy.gif",
"https://media.giphy.com/media/ldC6st7Bz3lZK/giphy.gif"
],
"self-harm":[
"https://media.giphy.com/media/A6r0BbR2ob1GE/giphy.gif",
"https://media.giphy.com/media/dFEd78w0sJNwA/giphy.gif"
],
"interesting":[
"https://media.giphy.com/media/10lKFp5Y03YITK/giphy.gif",
"https://media.giphy.com/media/ZPtGZIbpA1Z0Q/giphy.gif",
"https://media.giphy.com/media/hfV9dWY07x960/giphy.gif"
]
}
}
33 changes: 33 additions & 0 deletions bot/cogs/resources/zen.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"zen" : [
"Beautiful is better than ugly.",
"Explicit is better than implicit.",
"Simple is better than complex.",
"Complex is better than complicated.",
"Flat is better than nested.",
"Sparse is better than dense.",
"Readability counts.",
"Special cases aren't special enough to break the rules. Although practicality beats purity.",
"Errors should never pass silently. Unless explicitly silenced.",
"In the face of ambiguity, refuse the temptation to guess.",
"There should be one-- and preferably only one --obvious way to do it.",
"Although that way may not be obvious at first unless you're Dutch.",
"Now is better than never.",
"Although never is often better than *right* now.",
"If the implementation is hard to explain, it's a bad idea.",
"If the implementation is easy to explain, it may be a good idea.",
"Namespaces are one honking great idea -- let's do more of those!"
],

"gif":[
"https://media.giphy.com/media/jCodV34MoczjW/giphy.gif",
"https://media.giphy.com/media/ZLF9Loju0q3MA/giphy.gif",
"https://media.giphy.com/media/v4NCChJtoH076/giphy.gif",
"https://media.giphy.com/media/3o6Ztfi66HECEU0Z4k/giphy.gif",
"https://media.giphy.com/media/HNSv7wrNUK5Ko/giphy.gif",
"https://media.giphy.com/media/3oFzmdjqH15YebLQ52/giphy.gif",
"https://media.giphy.com/media/2PIjvGv9DKtJ6/giphy.gif",
"https://media.giphy.com/media/26DN0U3SqKDG2fTFe/giphy.gif",
"https://media.giphy.com/media/3o6EhXODzc79cnZfRC/giphy.gif"
]
}
Loading