Testing/CI #21

Merged
jp merged 40 commits from testing into master 2022-12-11 16:27:22 +01:00
2 changed files with 9 additions and 9 deletions
Showing only changes of commit 09477f3c4d - Show all commits
+5 -8
View File
@@ -221,20 +221,17 @@ class Shitpost(commands.Cog):
yield from ctx.channel.send(ctx.author.mention + ' ' + str(Message))
def get_giet_het_oan(self):
# Alsof we ooit nog een elfstedentocht gaan krijgen.
return "nee"
@commands.command(pass_context=True, hidden=False)
@asyncio.coroutine
def giethetaloan(self, ctx):
"""Giet het al oan?
Ja of Nee.. kom op nou.
"""
#We halen dit op van de twitter account @gietitaloan die vertrouwen wij als de ultieme waarheid
consumer = oauth.Consumer(key=os.getenv('STROOP_TWITTER_KEY'), secret=os.getenv('STROOP_TWITTER_SECRET'))
client = oauth.Client(consumer)
resp, content = client.request("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=gietitaloan&count=1", "GET")
#TODO kijken of resp iets zinnigs teruggeeft.. of iets doen met een try of catch ofzow
content_str = content.decode('utf-8') #converteren naar str voor welke stomme reden dan ook
answer = json.loads(content_str)[0]["text"] #inhoud van de tweet
answer = answer.lower()
answer = self.get_giet_het_oan()
reactie = ""
if 'ja' in answer:
if 'nee' in answer:
+3
View File
@@ -156,3 +156,6 @@ class TestShitpost(unittest.TestCase):
inspo = self.cog.get_inspiration()
self.assertIn("https://", inspo)
self.assertIn(".jpg", inspo)
def test_giethetaloan(self):
self.assertIn("nee", self.cog.get_giet_het_oan().lower())