refactors en echte tests ofzo
This commit is contained in:
+8
-6
@@ -8,7 +8,6 @@ import json, requests
|
||||
from discord.ext import commands
|
||||
from sympy import latex, symbols, preview, Symbol #for LaTeX images
|
||||
import youtube_dl
|
||||
import ffmpeg
|
||||
|
||||
class General(commands.Cog):
|
||||
"""Overal toegestaan."""
|
||||
@@ -16,6 +15,7 @@ class General(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self.voice_states = {}
|
||||
self.muzak_url = 'https://hdcon-muzak.herokuapp.com'
|
||||
self.r = praw.Reddit(
|
||||
user_agent='StroopwafelBot',
|
||||
client_secret=self.bot.tokens["redditSecret"],
|
||||
@@ -85,7 +85,7 @@ class General(commands.Cog):
|
||||
rkopieerpasta = self.r.subreddit('kopieerpasta')
|
||||
post = rkopieerpasta.random()
|
||||
|
||||
# Subreddits kunnen de random functie uitzetten, dus dit is de fallback:
|
||||
# Subreddits kunnen de random functie uitzetten, dus dit is de fallback:
|
||||
if post == None:
|
||||
post = rkopieerpasta.top('month', limit=250)
|
||||
listing = list(post)
|
||||
@@ -121,15 +121,17 @@ Op <https://gifrun.com/> kunt u bijvoorbeeld via een web-interface gifjes maken
|
||||
|
||||
Namens de directie van Stroopwafel B.V. onze excuses voor dit ongemak.""")
|
||||
|
||||
def get_playlist_json(self):
|
||||
return requests.get(self.muzak_url + '/stroopwafel')
|
||||
|
||||
@commands.command(pass_context=True)
|
||||
@asyncio.coroutine
|
||||
def playlist(self, ctx):
|
||||
"""HDcon2021 playlist"""
|
||||
muzak_url = 'https://hdcon-muzak.herokuapp.com'
|
||||
data = json.loads(requests.get(muzak_url + '/stroopwafel').content) # als dit faalt yolo no catch
|
||||
msg = 'Stemmen en nomineren kan hier: {}\n'.format(muzak_url)
|
||||
data = json.loads(self.get_playlist_json().content)
|
||||
msg = 'Stemmen en nomineren kan hier: {}\n'.format(self.muzak_url)
|
||||
msg += '*Er zijn al {} nummers genomineerd*\n'.format(data['stemCount'])
|
||||
yield from ctx.channel.send(msg)
|
||||
yield from ctx.channel.send(self.get_playlist_msg())
|
||||
|
||||
@commands.command(pass_context=True, hidden=True)
|
||||
@asyncio.coroutine
|
||||
|
||||
Reference in New Issue
Block a user