Testing/CI #21
+5
-8
@@ -221,20 +221,17 @@ class Shitpost(commands.Cog):
|
|||||||
|
|
||||||
yield from ctx.channel.send(ctx.author.mention + ' ' + str(Message))
|
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)
|
@commands.command(pass_context=True, hidden=False)
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def giethetaloan(self, ctx):
|
def giethetaloan(self, ctx):
|
||||||
"""Giet het al oan?
|
"""Giet het al oan?
|
||||||
Ja of Nee.. kom op nou.
|
Ja of Nee.. kom op nou.
|
||||||
"""
|
"""
|
||||||
#We halen dit op van de twitter account @gietitaloan die vertrouwen wij als de ultieme waarheid
|
answer = self.get_giet_het_oan()
|
||||||
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()
|
|
||||||
reactie = ""
|
reactie = ""
|
||||||
if 'ja' in answer:
|
if 'ja' in answer:
|
||||||
if 'nee' in answer:
|
if 'nee' in answer:
|
||||||
|
|||||||
@@ -156,3 +156,6 @@ class TestShitpost(unittest.TestCase):
|
|||||||
inspo = self.cog.get_inspiration()
|
inspo = self.cog.get_inspiration()
|
||||||
self.assertIn("https://", inspo)
|
self.assertIn("https://", inspo)
|
||||||
self.assertIn(".jpg", inspo)
|
self.assertIn(".jpg", inspo)
|
||||||
|
|
||||||
|
def test_giethetaloan(self):
|
||||||
|
self.assertIn("nee", self.cog.get_giet_het_oan().lower())
|
||||||
Reference in New Issue
Block a user