Skip to content

Commit

Permalink
added emojis, new readme
Browse files Browse the repository at this point in the history
  • Loading branch information
moutella committed Mar 20, 2020
1 parent 6763779 commit 30c561e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ Usage
# Account
Follow the bot at [@PokeDolar](https://twitter.com/PokeDolar)
# Special Thanks
[@garotilde](https://twitter.com/garotilde) for the idea.
[@garotilde](https://twitter.com/garotilde) and [Pokedollar-FB](https://www.facebook.com/pokedollar) for the idea.

[pokemon.json](https://github.com/fanzeyi/pokemon.json) from [@fanzeyi](https://github.com/fanzeyi) for the pokedex.json file and pictures
10 changes: 10 additions & 0 deletions emojis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from random import sample


def sad_emoji():
emojis = '😕😟🙁☹️😮😲🥺😦😧😨😰😥😢😭😱😖😣😞😓😩😫😤😡😠🤬💩😾😿🙀'
return sample(emojis, 1)[0]

def happy_emoji():
emojis = '😀😃😄😁😆😅🙂🙃😉😍😛🤑🤡😶'
return sample(emojis, 1)[0]
10 changes: 7 additions & 3 deletions update_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import requests

from decouple import config
from emojis import sad_emoji, happy_emoji

consumer_key = config('consumer_key')
consumer_secret = config('consumer_secret')
Expand Down Expand Up @@ -51,16 +52,19 @@
name = pokemon[pokeid-1]['name']['english']

imagepath = 'pokemon_img/{}.png'.format(pokeid)
emoji = ''
if not first_tweet:
if subiu:
status_template = "O dólar subiu para R${} :(\n\n #{} - {}"
status_template = "O dólar subiu para R${} {}\n\n #{} - {}"
emoji = sad_emoji()
else:
status_template = "O dólar caiu para R${}\n\n #{} - {}"
status_template = "O dólar caiu para R${} {}\n\n #{} - {}"
emoji = happy_emoji()
else:
status_template = "quanto tá o pokédólar? R${}\n\n #{} - {}"


status = status_template.format(dolar_real, pokeid, name)
status = status_template.format(dolar_real, emoji, pokeid, name)
api.update_with_media(imagepath, status)
config_file = open('config.json', 'w')
json.dump(data, config_file)
Expand Down

0 comments on commit 30c561e

Please sign in to comment.