diff --git a/.gitignore b/.gitignore index 2895fff3..aa132558 100644 --- a/.gitignore +++ b/.gitignore @@ -46,6 +46,9 @@ coverage.xml *.cover .hypothesis/ +# VSCode +.vscode/ + # Translations *.mo *.pot diff --git a/Pipfile b/Pipfile index 096fb9b3..998695f7 100644 --- a/Pipfile +++ b/Pipfile @@ -8,6 +8,9 @@ name = "pypi" aiodns = "*" aiohttp = "<2.3.0,>=2.0.0" websockets = ">=4.0,<5.0" +"beautifulsoup4" = "*" +lxml = "*" +pickledb = "*" [dev-packages] "flake8" = "*" diff --git a/Pipfile.lock b/Pipfile.lock index 4e5214bb..c0490afe 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "d797e580ddcddc99bf058109ab0306ad584c2902752a3d4076ba713fdc580fb7" + "sha256": "b8ab36703d8ce2fa38392deab80f14252e5cc5b96b786135514e33d8bbe8e6c4" }, "pipfile-spec": 6, "requires": { @@ -53,6 +53,15 @@ ], "version": "==2.0.1" }, + "beautifulsoup4": { + "hashes": [ + "sha256:11a9a27b7d3bddc6d86f59fb76afb70e921a25ac2d6cc55b40d072bd68435a76", + "sha256:7015e76bf32f1f574636c4288399a6de66ce08fb7b2457f628a8d70c0fbabb11", + "sha256:808b6ac932dccb0a4126558f7dfdcf41710dd44a4ef497a0bb59a77f9f078e89" + ], + "index": "pypi", + "version": "==4.6.0" + }, "chardet": { "hashes": [ "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae", @@ -67,6 +76,40 @@ ], "version": "==2.6" }, + "lxml": { + "hashes": [ + "sha256:01c45df6d90497c20aa2a07789a41941f9a1029faa30bf725fc7f6d515b1afe9", + "sha256:0c9fef4f8d444e337df96c54544aeb85b7215b2ed7483bb6c35de97ac99f1bcd", + "sha256:0e3cd94c95d30ba9ca3cff40e9b2a14e1a10a4fd8131105b86c6b61648f57e4b", + "sha256:0e7996e9b46b4d8b4ac1c329a00e2d10edcd8380b95d2a676fccabf4c1dd0512", + "sha256:1858b1933d483ec5727549d3fe166eeb54229fbd6a9d3d7ea26d2c8a28048058", + "sha256:1b164bba1320b14905dcff77da10d5ce9c411ac4acc4fb4ed9a2a4d10fae38c9", + "sha256:1b46f37927fa6cd1f3fe34b54f1a23bd5bea1d905657289e08e1297069a1a597", + "sha256:231047b05907315ae9a9b6925751f9fd2c479cf7b100fff62485a25e382ca0d4", + "sha256:28f0c6652c1b130f1e576b60532f84b19379485eb8da6185c29bd8c9c9bc97bf", + "sha256:34d49d0f72dd82b9530322c48b70ac78cca0911275da741c3b1d2f3603c5f295", + "sha256:3682a17fbf72d56d7e46db2e80ca23850b79c28cfe75dcd9b82f58808f730909", + "sha256:3cf2830b9a6ad7f6e965fa53a768d4d2372a7856f20ffa6ce43d2fe9c0d34b19", + "sha256:5b653c9379ce29ce271fbe1010c5396670f018e78b643e21beefbb3dc6d291de", + "sha256:65a272821d5d8194358d6b46f3ca727fa56a6b63981606eac737c86d27309cdd", + "sha256:691f2cd97cf026c611df1ea5055755eec7f878f2d4f4330dc8686583de6fc5fd", + "sha256:6b6379495d3baacf7ed755ac68547c8dff6ce5d37bf370f0b7678888dc1283f9", + "sha256:75322a531504d4f383264391d89993a42e286da8821ddc5ac315e57305cb84f0", + "sha256:7f457cbda964257f443bac861d3a36732dcba8183149e7818ee2fb7c86901b94", + "sha256:7ff1fc76d8804e0f870c343a72007ff587090c218b0f92d8ee784ac2b6eaf5b9", + "sha256:8523fbde9c2216f3f2b950cb01ebe52e785eaa8a07ffeb456dd3576ca1b4fb9b", + "sha256:8f37627f16e026523fca326f1b5c9a43534862fede6c3e99c2ba6a776d75c1ab", + "sha256:a7182ea298cc3555ea56ffbb0748fe0d5e0d81451e2bc16d7f4645cd01b1ca70", + "sha256:abbd2fb4a5a04c11b5e04eb146659a0cf67bb237dd3d7ca3b9994d3a9f826e55", + "sha256:accc9f6b77bed0a6f267b4fae120f6008a951193d548cdbe9b61fc98a08b1cf8", + "sha256:bd88c8ce0d1504fdfd96a35911dd4f3edfb2e560d7cfdb5a3d09aa571ae5fbae", + "sha256:c557ad647facb3c0027a9d0af58853f905e85a0a2f04dcb73f8e665272fcdc3a", + "sha256:defabb7fbb99f9f7b3e0b24b286a46855caef4776495211b066e9e6592d12b04", + "sha256:e2629cdbcad82b83922a3488937632a4983ecc0fed3e5cfbf430d069382eeb9b" + ], + "index": "pypi", + "version": "==4.2.1" + }, "multidict": { "hashes": [ "sha256:0462372fc74e4c061335118a4a5992b9a618d6c584b028ef03cf3e9b88a960e2", @@ -94,6 +137,13 @@ ], "version": "==4.1.0" }, + "pickledb": { + "hashes": [ + "sha256:0dc2f5fa0d5fad415aeafac25f3f4992a6d77e182087df6ea90e63b457c92cac" + ], + "index": "pypi", + "version": "==0.6.2" + }, "pycares": { "hashes": [ "sha256:0e81c971236bb0767354f1456e67ab6ae305f248565ce77cd413a311f9572bf5", @@ -120,6 +170,32 @@ ], "version": "==2.3.0" }, + "simplejson": { + "hashes": [ + "sha256:06b69946903ffd593d45624bdc354c1b857c2b1690ed2112df88d0e4e0294b06", + "sha256:194fa08e4047f16e7087f2a406abd15151a482a097e42d8babb1b8181b2232b1", + "sha256:1c9c13077560b8c0404c38d8e385d9e171aa8aec2a9b3139ded315a4c5ffc4d8", + "sha256:26f70a009c70866a07c43e25d6d9a1fb027ecef110a6c93cc8aec04ddf2ad05f", + "sha256:335d2a6afdd3a31f4ef210b46e6824848491c969f4b3a655d1864f655d57c5d3", + "sha256:43dc3082f3a8fd5bb0c80df5a8ab96d81eafeca701615aaa0b01910b1869e678", + "sha256:44a7e0e117032666d37bcfa42161c7eb27c6ed9100d260e5b25751a6d8d7a2e8", + "sha256:4c4ecf20e054716cc1e5a81cadc44d3f4027108d8dd0861d8b1e3bd7a32d4f0a", + "sha256:5539547ba11f4affcdc4890cc85bfdd3f2d7186042d91e9340add98699cc3d50", + "sha256:6560b68e98aba17afa4e898aab21d06d549738267dbe4d0981a24b4c1db66368", + "sha256:6cf42bc495f7e3fd25e92912a22f47e439f3a809814103a1b727d373f758915a", + "sha256:b2e64d1695bcd0d916e8633ab12179bde8d96e8cbd18d9d0c3020409cfaf8091", + "sha256:b4967af248c1fde0b184d81b2aa9646d96a400342d26f837e772a1dcb11cdc10", + "sha256:c1347a0d6e90d4a0fd67514c8691346c5cd1ee6039415eba97690f4b5d594915", + "sha256:c62045146474c41c5b9e4c758873b3b2872b3e0fefd2b87de3f08292c370fce6", + "sha256:c64c9972a847b5de9a47f5e3a06b280ee3301ac83089cc9d7ea922f7cea5954c", + "sha256:cf669980df3a6db918e69920df3eaf52901aa4c007287070a8b6e0da811cd2a2", + "sha256:e95f107de632ae6effa6915f194f2c282db592b9aa449070a5f9c065c478ec47", + "sha256:ec0d482b9d28c123a2c6ccfa5341d47734b1dee2d61a655a99f26ef9c0080ce7", + "sha256:ec7b08ffefae94b2c0a85df4ec17e3ada8f9f2bfae18e8b6812ece366917d0c5", + "sha256:ef822f66d932a7ced43844a4684d7bd24c4cc7ebe8030ee7277cf7c033e58a13" + ], + "version": "==3.13.2" + }, "websockets": { "hashes": [ "sha256:0c31bc832d529dc7583d324eb6c836a4f362032a1902723c112cf57883488d8c", @@ -282,10 +358,10 @@ }, "gitpython": { "hashes": [ - "sha256:ad61bc25deadb535b047684d06f3654c001d9415e1971e51c9c20f5b510076e9", - "sha256:b8367c432de995dc330b5b146c5bfdc0926b8496e100fda6692134e00c0dcdc5" + "sha256:05069e26177c650b3cb945dd543a7ef7ca449f8db5b73038b465105673c1ef61", + "sha256:c47cc31af6e88979c57a33962cbc30a7c25508d74a1b3a19ec5aa7ed64b03129" ], - "version": "==2.1.8" + "version": "==2.1.9" }, "idna": { "hashes": [ diff --git a/bot/cogs/WikiListener.py b/bot/cogs/WikiListener.py new file mode 100644 index 00000000..346437a4 --- /dev/null +++ b/bot/cogs/WikiListener.py @@ -0,0 +1,63 @@ +import json + +import aiohttp + +""" + +Handle requests and grab and returns detail from wikipedia using MediaWiki. + +""" + + +async def get_json(url): + """ Returns the text from request to url """ + async with aiohttp.ClientSession() as session: + async with session.get(url) as resp: + return await resp.text() + + +def get_all_snek(): + """" Gets all valid snake from a text file """ + file_save = open("bot/snakedata/common-snake-names.txt", "r") + snake_text = file_save.read() + snake_names = snake_text.split("\n") + print("Returned all snake names") + return snake_names + + +async def get_raw_json(name): + """ Returns a dictionary from the JSON grabbed from MediaWiki API. """ + api_url = f'https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts|pageimages&exintro=&explaintext=&titles={name}&redirects=1' + raw_json = await get_json(api_url) + clean_json = json.loads(raw_json) + return clean_json + + +async def get_snek_description(name: str = None): + """ Returns 'extract' text from JSON, using a dictionary """ + json_dict = await get_raw_json(name) + return list(json_dict['query']['pages'].values())[0]['extract'] + + +async def get_snek_scientific(name: str = None): + """ Returns 'title' text from JSON, using a dictionary """ + json_dict = await get_raw_json(name) + scientific = list(json_dict['query']['pages'].values())[0]['title'] + if scientific == name: + return None + else: + return scientific + + +async def get_snek_thumbnail(name: str = None): + """ Returns 'thumbnail' source from JSON, using a dictionary """ + json_dict = await get_raw_json(name) + return list(json_dict['query']['pages'].values())[0]['thumbnail']['source'] + + +async def get_snek_url(name: str = None): + """ Returns the url of the snake searched """ + json_dict = await get_raw_json(name) + title = list(json_dict['query']['pages'].values())[0]['title'] + url = f'https://en.wikipedia.org/wiki/{title}' + return url diff --git a/bot/cogs/snakes.py b/bot/cogs/snakes.py index c9ed8042..14ee9b48 100644 --- a/bot/cogs/snakes.py +++ b/bot/cogs/snakes.py @@ -1,8 +1,12 @@ # coding=utf-8 import logging from typing import Any, Dict - +from bot.cogs import WikiListener from discord.ext.commands import AutoShardedBot, Context, command +import discord +import aiohttp +import random +import json log = logging.getLogger(__name__) @@ -15,35 +19,73 @@ class Snakes: def __init__(self, bot: AutoShardedBot): self.bot = bot - async def get_snek(self, name: str = None) -> Dict[str, Any]: - """ - Go online and fetch information about a snake - - The information includes the name of the snake, a picture of the snake, and various other pieces of info. - What information you get for the snake is up to you. Be creative! + async def is_snek(self, name: str = None) -> Dict[str, Any]: + if name in WikiListener.get_all_snek(): + return True + else: + return False - If "python" is given as the snake name, you should return information about the programming language, but with - all the information you'd provide for a real snake. Try to have some fun with this! + @command() + async def get(self, ctx: Context, name: str = None): - :param name: Optional, the name of the snake to get information for - omit for a random snake - :return: A dict containing information on a snake - """ + if name is None: + ctx.send("Ensure your command specifies the correct arguments.") + state = await self.is_snek(name) + if state: + if WikiListener.get_snek_scientific(name) is None: + title = await WikiListener.get_snek_scientific(name) + description = await WikiListener.get_snek_description(name) + embed = discord.Embed(title=f"{name}", description=f"{description}", color=0x00ff80) + try: + thumbnail = await WikiListener.get_snek_thumbnail(name) + embed.set_thumbnail(url=f'{thumbnail}') + except aiohttp.web.HTTPExceptionError: + pass + await ctx.send(embed=embed) + else: + title = await WikiListener.get_snek_scientific(name) + description = await WikiListener.get_snek_description(name) + embed = discord.Embed(title=f"{name}", description=f"{description}", color=0x00ff80) + embed.set_author(name=f"{title}") + try: + thumbnail = await WikiListener.get_snek_thumbnail(name) + embed.set_thumbnail(url=f'{thumbnail}') + except aiohttp.web.HTTPClientError: + pass + await ctx.send(embed=embed) + else: + await ctx.channel.send(f"Did not find {name} in the database.") @command() - async def get(self, ctx: Context, name: str = None): - """ - Go online and fetch information about a snake + async def quiz(self, ctx: Context, name: str = None): + async def addmoji(msg, emojilist): + for emoji in emojilist: + await msg.add_reaction(emoji) + with open("bot/snakedata/questions.json") as quizson: + questions = json.load(quizson) - This should make use of your `get_snek` method, using it to get information about a snake. This information - should be sent back to Discord in an embed. + quemoji = ['šŸ‡¦', 'šŸ‡§', 'šŸ‡Ø', 'šŸ‡©'] + random_quiz = questions["questions"][random.randint(0,10)] + em = discord.Embed(title=random_quiz['question'], description='šŸ‡¦ {0}\n\nšŸ‡§ {1}\n\nšŸ‡Ø {2}\n\nšŸ‡© {3}'.format(random_quiz['a'],random_quiz['b'],random_quiz['c'],random_quiz['d'])) + channel = ctx.channel + quiz = await channel.send('', embed=em) + await addmoji(quiz, quemoji) - :param ctx: Context object passed from discord.py - :param name: Optional, the name of the snake to get information for - omit for a random snake - """ + def check(reaction, user): + return user == ctx.author and str(reaction.emoji) - # Any additional commands can be placed here. Be creative, but keep it to a reasonable amount! + try: + reaction, user = await ctx.bot.wait_for('reaction_add', timeout=20.0, check=check) + except asyncio.TimeoutError as err: + await channel.send('Bah! You took too long.') + else: + if str(reaction.emoji) == random_quiz["answerkey"]: + await channel.send('That was correct! Well done!') + else: + await channel.send('That was incorrect! The correct answer was {0}, unfortunately.'.format(random_quiz["answerkey"])) +# Any additional commands can be placed here. Be creative, but keep it to a reasonable amount! def setup(bot): bot.add_cog(Snakes(bot)) log.info("Cog loaded: Snakes") diff --git a/bot/snakedata/common-snake-names.txt b/bot/snakedata/common-snake-names.txt new file mode 100644 index 00000000..47011efc --- /dev/null +++ b/bot/snakedata/common-snake-names.txt @@ -0,0 +1,955 @@ +viper adder +common adder +death adder +desert death adder +horned adder +long-nosed adder +many-horned adder +mountain adder +mud adder +namaqua dwarf adder +nightingale adder +peringuey's adder +puff adder +african puff adder +rhombic night adder +sand adder +dwarf sand adder +namib dwarf sand adder +water adder +aesculapian snake +anaconda +bolivian anaconda +de schauensee's anaconda +green anaconda +yellow anaconda +arafura file snake +asp +european asp +egyptian asp +african beaked snake +ball python +bird snake +black-headed snake +mexican black kingsnake +black rat snake +black snake +red-bellied black snake +blind snake +brahminy blind snake +texas blind snake +western blind snake +boa +abaco island boa +amazon tree boa +boa constrictor +cuban boa +dumeril's boa +dwarf boa +emerald tree boa +hogg island boa +jamaican boa +madagascar ground boa +madagascar tree boa +puerto rican boa +rainbow boa +red-tailed boa +rosy boa +rubber boa +sand boa +tree boa +boiga +boomslang +brown snake +eastern brown snake +bull snake +bushmaster +dwarf beaked snake +rufous beaked snake +canebrake +cantil +cascabel +cat-eyed snake +banded cat-eyed snake +green cat-eyed snake +cat snake +andaman cat snake +beddome's cat snake +dog-toothed cat snake +forsten's cat snake +gold-ringed cat snake +gray cat snake +many-spotted cat snake +nicobar cat snake +sri lanka cat snake +tawny cat snake +chicken snake +coachwhip snake +cobra +andaman cobra +arabian cobra +asian cobra +banded water cobra +black-necked cobra +black-necked spitting cobra +black tree cobra +burrowing cobra +cape cobra +caspian cobra +chinese cobra +cobra de capello +congo water cobra +common cobra +eastern water cobra +egyptian cobra +equatorial spitting cobra +false cobra +false water cobra +forest cobra +gold tree cobra +indian cobra +indochinese spitting cobra +javan spitting cobra +king cobra +mandalay cobra +monocled cobra +monoculate cobra +mozambique spitting cobra +north philippine cobra +nubian spitting cobra +philippine cobra +red spitting cobra +rinkhals cobra +shield-nosed cobra +sinai desert cobra +southern indonesian spitting cobra +southern philippine cobra +southwestern black spitting cobra +snouted cobra +spectacled cobra +spitting cobra +storm water cobra +thai cobra +west african brown spitting cobra +white-lipped cobra +yellow cobra +zebra spitting cobra +collett's snake +congo snake +copperhead +american copperhead +australian copperhead +coral snake +arizona coral snake +beddome's coral snake +brazilian coral snake +cape coral snake +eastern coral snake +false coral snake +harlequin coral snake +high woods coral snake +malayan long-glanded coral snake +texas coral snake +western coral snake +corn snake +south eastern corn snake +cottonmouth +crowned snake +cuban wood snake +eastern hognose snake +egg-eater +indian egg-eater +eyelash viper +eastern coral snake +fer-de-lance +fierce snake +fishing snake +flying snake +golden tree snake +indian flying snake +moluccan flying snake +ornate flying snake +paradise flying snake +twin-barred tree snake +banded flying snake +fox snake, three species of pantherophis +forest flame snake +garter snake +checkered garter snake +common garter snake +san francisco garter snake +texas garter snake +glossy snake +gopher snake +cape gopher snake +grass snake +green snake +rough green snake +smooth green snake +ground snake +common ground snake +three-lined ground snake +western ground snake +habu +himehabu +okinawan habu +sakishima habu +tokara habu +harlequin snake +elaps harlequin snake +herald snake +hognose snake +blonde hognose snake +dusty hognose snake +eastern hognose snake +jan's hognose snake +giant malagasy hognose snake +mexican hognose snake +plains hognose snake +ringed hognose snake +south american hognose snake +southern hognose snake +speckled hognose snake +tri-color hognose snake +western hognose snake +hoop snake +hundred pacer +ikaheka snake +indigo snake +jamaican tree snake +jararacussu +keelback +andrea's keelback +asian keelback +assam keelback +black-striped keelback +buff striped keelback +burmese keelback +checkered keelback +common keelback +hill keelback +himalayan keelback +khasi hills keelback +modest keelback +nicobar island keelback +nilgiri keelback +orange-collared keelback +red-necked keelback +sikkim keelback +speckle-bellied keelback +tiger keelback +wall's keelback +white-lipped keelback +wynaad keelback +yunnan keelback +king brown +king cobra +king snake +california kingsnake +desert kingsnake +grey-banded kingsnake +north eastern king snake +prairie kingsnake +scarlet kingsnake +speckled kingsnake +krait +banded krait +blue krait +black krait +burmese krait +ceylon krait +indian krait +lesser black krait +malayan krait +many-banded krait +northeastern hill krait +red-headed krait +sind krait +south andaman krait +large shield snake +lancehead +common lancehead +lora +grey lora +lyre snake +baja california lyresnake +central american lyre snake +texas lyre snake +eastern lyre snake +machete savane +mamba +black mamba +green mamba +eastern green mamba +western green mamba +mamushi +mangrove snake +milk snake +moccasin snake +montpellier snake +mud snake +eastern mud snake +western mud snake +mussurana +night snake +cat-eyed night snake +texas night snake +nichell snake +narrowhead garter snake +nose-horned viper +parrot snake +mexican parrot snake +patchnose snake +perrotet's shieldtail snake +pine snake +pipe snake +asian pipe snake +dwarf pipe snake +red-tailed pipe snake +african rock python +amethystine python +angolan python +australian scrub python +ball python +bismarck ringed python +black headed python +blood python +boelen python +borneo short-tailed python +bredl's python +brown water python +burmese python +calabar python +western carpet python +centralian carpet python +coastal carpet python +inland carpet python +jungle carpet python +new guinea carpet python +northwestern carpet python +southwestern carpet python +children's python +dauan island water python +desert woma python +diamond python +flinders python +green tree python +halmahera python +indian python +indonesian water python +macklot's python +mollucan python +oenpelli python +olive python +papuan python +pygmy python +red blood python +reticulated python +kayaudi dwarf reticulated python +selayer reticulated python +rough-scaled python +royal python +savu python +spotted python +stimson's python +sumatran short-tailed python +tanimbar python +timor python +wetar island python +white-lipped python +brown white-lipped python +northern white-lipped python +southern white-lipped python +woma python +western woma python +queen snake +racer +bimini racer +buttermilk racer +eastern racer +eastern yellowbelly sad racer +mexican racer +southern black racer +tan racer +west indian racer +raddysnake +southwestern blackhead snake +rat snake +baird's rat snake +beauty rat snake +great plains rat snake +green rat snake +japanese forest rat snake +japanese rat snake +king rat snake +mandarin rat snake +persian rat snake +twin-spotted rat snake +yellow-striped rat snake +manchurian black water snake +rattlesnake +arizona black rattlesnake +aruba rattlesnake +chihuahuan ridge-nosed rattlesnake +coronado island rattlesnake +durango rock rattlesnake +dusky pigmy rattlesnake +eastern diamondback rattlesnake +grand canyon rattlesnake +great basin rattlesnake +hopi rattlesnake +lance-headed rattlesnake +long-tailed rattlesnake +massasauga rattlesnake +mexican green rattlesnake +mexican west coast rattlesnake +midget faded rattlesnake +mojave rattlesnake +northern black-tailed rattlesnake +oaxacan small-headed rattlesnake +rattler +red diamond rattlesnake +southern pacific rattlesnake +southwestern speckled rattlesnake +tancitaran dusky rattlesnake +tiger rattlesnake +timber rattlesnake +tropical rattlesnake +twin-spotted rattlesnake +uracoan rattlesnake +western diamondback rattlesnake +ribbon snake +rinkhals +river jack +sea snake +annulated sea snake +beaked sea snake +dubois's sea snake +hardwicke's sea snake +hook nosed sea snake +olive sea snake +pelagic sea snake +stoke's sea snake +yellow-banded sea snake +yellow-bellied sea snake +yellow-lipped sea snake +scott shields barrows deadliest snake +shield-tailed snake +sidewinder +colorado desert sidewinder +mojave desert sidewinder +sonoran sidewinder +small-eyed snake +smooth snake +brazilian smooth snake +european smooth snake +sonoran +stiletto snake +striped snake +japanese striped snake +sunbeam snake +taipan +central ranges taipan +coastal taipan +inland taipan +paupan taipan +tentacled snake +tic polonga +tiger snake +chappell island tiger snake +common tiger snake +down's tiger snake +eastern tiger snake +king island tiger snake +krefft's tiger snake +peninsula tiger snake +tasmanian tiger snake +western tiger snake +tigre snake +tree snake +blanding's tree snake +blunt-headed tree snake +brown tree snake +long-nosed tree snake +many-banded tree snake +northern tree snake +trinket snake +black-banded trinket snake +twig snake +african twig snake +twin headed king snake +titanboa +urutu +vine snake +asian vine snake, whip snake +american vine snake +mexican vine snake +viper +asp viper +bamboo viper +bluntnose viper +brazilian mud viper +burrowing viper +bush viper +great lakes bush viper +hairy bush viper +nitsche's bush viper +rough-scaled bush viper +spiny bush viper +carpet viper +crossed viper +cyclades blunt-nosed viper +eyelash viper +false horned viper +fea's viper +fifty pacer +gaboon viper +hognosed viper +horned desert viper +horned viper +jumping viper +kaznakov's viper +leaf-nosed viper +leaf viper +levant viper +long-nosed viper +mcmahon's viper +mole viper +nose-horned viper +palestine viper +pallas' viper +palm viper +amazonian palm viper +black-speckled palm-pitviper +eyelash palm-pitviper +green palm viper +mexican palm-pitviper +guatemalan palm viper +honduran palm viper +siamese palm viper +side-striped palm-pitviper +yellow-lined palm viper +pit viper +banded pitviper +bamboo pitviper +barbour's pit viper +black-tailed horned pit viper +bornean pitviper +brongersma's pitviper +brown spotted pitviper +cantor's pitviper +elegant pitviper +eyelash pit viper +fan-si-pan horned pitviper +flat-nosed pitviper +godman's pit viper +green tree pit viper +habu pit viper +hagen's pitviper +horseshoe pitviper +jerdon's pitviper +kanburian pit viper +kaulback's lance-headed pitviper +kham plateau pitviper +large-eyed pitviper +malabar rock pitviper +malayan pit viper +mangrove pit viper +mangshan pitviper +motuo bamboo pitviper +nicobar bamboo pitviper +philippine pitviper +red-tailed bamboo pitviper +schultze's pitviper +stejneger's bamboo pitviper +sri lankan pit viper +temple pit viper +tibetan bamboo pitviper +tiger pit viper +undulated pit viper +wagler's pit viper +wirot's pit viper +portuguese viper +rhinoceros viper +river jack +russell's viper +sand viper +saw-scaled viper +schlegel's viper +sedge viper +sharp-nosed viper +snorkel viper +temple viper +tree viper +chinese tree viper +guatemalan tree viper +hutton's tree viper +indian tree viper +large-scaled tree viper +malcolm's tree viper +nitsche's tree viper +pope's tree viper +rough-scaled tree viper +rungwe tree viper +sumatran tree viper +white-lipped tree viper +ursini's viper +western hog-nosed viper +wart snake +water moccasin +water snake +bocourt's water snake +northern water snake +whip snake +long-nosed whip snake +wolf snake +african wolf snake +barred wolf snake +worm snake +common worm snake +longnosed worm snake +wutu +yarara +zebra snake +acutotyphlops infralabialis +acutotyphlops kunuaensis +afrotyphlops blanfordii +afrotyphlops kaimosae +afrotyphlops manni +afrotyphlops nanus +afrotyphlops rondoensis +letheobia erythraea +letheobia leucostictus +letheobia pallida +letheobia pembana +letheobia stejnegeri +ramphotyphlops angusticeps +ramphotyphlops becki +ramphotyphlops cumingii +ramphotyphlops lorenzi +ramphotyphlops mansuetus +ramphotyphlops marxi +ramphotyphlops similis +ramphotyphlops supranasalis +ramphotyphlops willeyi +typhlops andasibensis +typhlops bothriorhynchus +typhlops collaris +typhlops comorensis +typhlops conradi +typhlops exiguus +typhlops filiformis +typhlops giandinhensis +typhlops hypogius +typhlops hypsobothrius +typhlops klemmeri +typhlops koekkoeki +typhlops koshunensis +typhlops luzonensis +typhlops manilae +typhlops meszoelyi +typhlops oatesii +typhlops ozakiae +typhlops platyrhynchus +typhlops reuteri +typhlops roxaneae +typhlops ruficaudus +typhlops siamensis +typhlops socotranus +typhlops tenuicollis +typhlops thurstoni +typhlops trangensis +typhlops wilsoni +atheris hirsuta +echis hughesi +echis jogeri +echis megalocephalus +gloydius monticola +popeia toba +porthidium hespere +protobothrops kaulbacki +protobothrops maolanensis +pseudocerastes urarachnoides +sinovipera sichuanensis +viridovipera medoensis +adelphicos latifasciatum +apostolepis dorbignyi +apostolepis goiasensis +atractus balzani +atractus biseriatus +atractus ecuadorensis +atractus favae +atractus indistinctus +atractus lehmanni +atractus melanogaster +atractus nigriventris +atractus obesus +atractus obtusirostris +atractus oculotemporalis +atractus pauciscutatus +atractus peruvianus +atractus variegatus +atractus vertebralis +coniophanes sarae +diaphorolepis laevis +dipsas sanctijoannis +emmochliophis fugleri +enulius oligostichus +erythrolamprus pyburni +geophis betaniensis +geophis bicolor +geophis blanchardi +geophis chalybeus +geophis championi +geophis downsi +geophis dunni +geophis incomptus +geophis isthmicus +geophis laticollaris +geophis latifrontalis +geophis maculiferus +geophis nigrocinctus +geophis pyburni +geophis russatus +geophis sallaei +geophis sieboldi +geophis tarascae +hydromorphus dunni +hypsiglena tanzeri +imantodes phantasma +lygophis vanzolinii +plesiodipsas perijanensis +rhadinaea bogertorum +rhadinaea cuneata +rhadinaea forbesi +rhadinaea gaigeae +rhadinaea macdougalli +rhadinaea myersi +rhadinaea omiltemana +rhadinaea pulveriventris +rhadinaea quinquelineata +rhadinella hannsteini +saphenophis antioquiensis +saphenophis atahuallpae +sibon dunni +synophis lasallei +tachymenis tarmensis +tretanorhinus mocquardi +trimetopon barbouri +platyplectrurus trilineatus +plectrurus aureus +plectrurus canaricus +plectrurus guentheri +rhinophis fergusonianus +uropeltis beddomii +uropeltis broughami +uropeltis dindigalensis +uropeltis liura +uropeltis macrorhynchus +uropeltis maculatus +uropeltis myhendrae +uropeltis nitidus +uropeltis petersi +aipysurus tenuis +calliophis beddomei +calliophis gracilis +demansia torquata +enhydrina zweifeli +hydrophis belcheri +hydrophis bituberculatus +hydrophis cantoris +hydrophis czeblukovi +hydrophis inornatus +hydrophis klossi +hydrophis mamillaris +hydrophis melanosoma +hydrophis nigrocinctus +hydrophis sibauensis +hydrophis stricticollis +hydrophis torquatus +hydrophis vorisi +hydrophis walli +kolpophis annandalei +micrurus bogerti +micrurus petersi +naja oxiana +parahydrophis mertoni +parapistocalamus hedigeri +thalassophis anomalus +toxicocalamus grandis +toxicocalamus misimae +toxicocalamus spilolepidotus +calamaria abstrusa +calamaria alidae +calamaria battersbyi +calamaria boesemani +calamaria buchi +calamaria crassa +calamaria doederleini +calamaria eiselti +calamaria forcarti +calamaria gialaiensis +calamaria gracilima +calamaria javanica +calamaria lateralis +calamaria lumholtzi +calamaria margaritophora +calamaria mecheli +calamaria palavanensis +calamaria pfefferi +calamaria rebentischi +calamaria sangi +calamaria thanhi +calamaria ulmeri +etheridgeum pulchrum +pseudorabdion taylori +gonionotophis egbensis +gonionotophis gabouensis +lamprophis fiskii +lycophidion hellmichi +enhydris albomaculata +enhydris alternans +enhydris bennettii +enhydris chanardi +enhydris gyii +enhydris indica +enhydris innominata +enhydris jagorii +enhydris maculosa +enhydris matannensis +enhydris pahangensis +enhydris punctata +heurnia ventromaculata +blythia reticulata +boiga beddomei +boiga bengkuluensis +boiga dightoni +boiga multifasciata +coelognathus enganensis +coluber bholanathi +coluber gracilis +coluber insulanus +coluber thomasi +colubroelaps nguyenvansangi +cyclophiops hamptoni +dendrelaphis papuensis +dendrelaphis underwoodi +dryocalamus gracilis +iguanognathus werneri +liopeltis rappi +lycodon cardamomensis +lycodon gongshan +lycodon kundui +lycodon rosozonatus +lycodon synaptor +lycodon tessellatus +meizodon krameri +myersophis alpestris +oligodon annamensis +oligodon durheimi +oligodon erythrorhachis +oligodon hamptoni +oligodon jintakunei +oligodon macrurus +oligodon moricei +oligodon multizonatus +oligodon nikhili +oligodon ningshaanensis +oligodon petronellae +oligodon praefrontalis +oligodon saintgironsi +oligodon travancoricus +oligodon vertebralis +pantherophis slowinskii +ptyas dipsas +rhynchocalamus arabicus +sibynophis bistrigatus +spalerosophis dolichospilus +tantilla albiceps +tantilla andinista +tantilla bairdi +tantilla briggsi +tantilla cascadae +tantilla nigra +tantilla oaxacae +tantilla slavensi +tantilla striata +tantilla tayrae +tantilla triseriata +zamenis lineatus +zamenis persica +adelophis foxi +aspidura copei +hebius andreae +hebius atemporale +hebius frenatum +hebius groundwateri +hebius kerinciense +hebius viperinum +herpetoreas sieboldii +hydrablabes praefrontalis +opisthotropis cucae +opisthotropis jacobi +opisthotropis maculosa +opisthotropis maxwelli +opisthotropis spenceri +opisthotropis tamdaoensis +parahelicops annamensis +parahelicops boonsongi +pararhabdophis chapaensis +rhabdophis angeli +rhabdophis callichroma +rhabdophis chrysargoides +tropidonophis elongatus +tropidonophis punctiventris +xenochrophis bellula +amblyodipsas rodhaini +amblyodipsas teitana +xenocalamus michellii +xenocalamus transvaalensis +anomalepis flavapices +anomalepis mexicanus +helminthophis frontalis +liotyphlops schubarti +epacrophis boulengeri +epacrophis drewsi +epictia melanurus +epictia peruviana +epictia rubrolineata +epictia undecimstriata +leptotyphlops filiformis +leptotyphlops howelli +leptotyphlops keniensis +leptotyphlops macrurus +leptotyphlops mbanjensis +leptotyphlops wilsoni +myriopholis natatrix +myriopholis yemenicus +namibiana rostrata +rena bressoni +rhinoleptus parkeri +trilepida brevissima +trilepida nicefori +gerrhopilus beddomii +gerrhopilus bisubocularis +gerrhopilus floweri +gerrhopilus fredparkeri +gerrhopilus hedraeus +gerrhopilus mcdowelli +gerrhopilus oligolepis +gerrhopilus tindalli +anomochilus monticola +anomochilus weberi +cylindrophis aruensis +cylindrophis engkariensis +cylindrophis lineatus +eunectes deschauenseei +fimbrios smithi +pareas iwasakii +pareas nigriceps +pareas stanleyi +plagiopholis unipostocularis +pseudoxenodon baramensis +pseudoxenodon jacobsonii +xenophidion schaeferi +xylophis stenorhynchus \ No newline at end of file diff --git a/bot/snakedata/questions.json b/bot/snakedata/questions.json new file mode 100644 index 00000000..cad3f7fa --- /dev/null +++ b/bot/snakedata/questions.json @@ -0,0 +1,104 @@ +{ + "questions":[ + { + "id": 0, + "question": "How long have snakes been roaming the Earth?", + "a":"3 million years", + "b":"30 million years", + "c":"130 million years", + "d":"200 million years", + "answerkey":"c" + }, + { + "id": 1, + "question": "What characteristics do all snakes share?", + "a":"They are carnivoes", + "b":"They are all programming languages", + "c":"Cold-blooded", + "d":"They are both carnivores and cold-blooded", + "answerkey":"c" + }, + { + "id": 2, + "question": "How snakes hear?", + "a":"With small ears", + "b":"Through their skin", + "c":"Through their tail", + "d":"They don't use their ears at all", + "answerkey":"b" + }, + { + "id": 3, + "question": "What don't snakes see?", + "a":"Colour", + "b":"Light", + "c":"Both of the above", + "d":"Other snakes", + "answerkey":"a" + }, + { + "id": 4, + "question": "What unique vision ability do boas and pythons possess?", + "a":"Night vision", + "b":"Infared vision", + "c":"See through walls", + "d":"They don't have vision", + "answerkey":"b" + }, + { + "id": 5, + "question": "How does a snake smell?", + "a":"Through its nose", + "b":"Through its tongue", + "c":"Through its ears", + "d":"Both through its nose and its tongues", + "answerkey":"d" + }, + { + "id": 6, + "question": "Where are Jacobson's organs located in snakes?", + "a":"Mouth", + "b":"Tail", + "c":"Stomach", + "d":"Liver", + "answerkey":"a" + }, + { + "id": 7, + "question": "Snakes have very similar internal organs compared to humans. Snakes, however; lack the following:", + "a":"A diaphragm", + "b":"Intestines", + "c":"Lungs", + "d":"Kidney", + "answerkey":"a" + }, + { + "id": 8, + "question": "Snakes have different shaped lungs than humans. What do snakes have?", + "a":"An elongated right lung", + "b":"A small left lung", + "c":"Both of the above", + "d":"None of the above", + "answerkey":"c" + }, + { + "id": 9, + "question": "What's true about two-headed snakes?", + "a":"They're a myth!", + "b":"Rarely survive in the wild", + "c":"They're very dangerous", + "d":"They can kiss each other", + "answerkey":"b" + }, + { + "id": 10, + "question": "What substance covers a snake's skin?", + "a":"Calcium", + "b":"Keratin", + "c":"Copper", + "d":"Iron", + "answerkey":"b" + } + ] + +} \ No newline at end of file diff --git a/run.bat b/run.bat new file mode 100644 index 00000000..cc0f3432 --- /dev/null +++ b/run.bat @@ -0,0 +1,2 @@ +cd C:\Users\Refath\Documents\Refath\Coding\CodeJam-1\code-jam-1 +pipenv run python run.py \ No newline at end of file