Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a2319f0fac | |||
| a4ca645e3e | |||
| acb9df8616 | |||
| 1f848861e3 | |||
| ecc3ae8853 | |||
| e904451037 | |||
| cde205aad7 | |||
| 2e91781fad | |||
| 58ce3a8565 |
+8
-4
@@ -46,7 +46,6 @@ class Chatbot(commands.Cog):
|
|||||||
"Hoi",
|
"Hoi",
|
||||||
"hmm?",
|
"hmm?",
|
||||||
"JA WAT?",
|
"JA WAT?",
|
||||||
"Godve...Godver-fucking-domme! Wie de fuck heeft me zojuist gepingt? Wie de fuck heeft de ballen om mij te pingen?! Als ik jou vind hè, ik ram je helemaal de tyfus in. Ik ga je kapot maken. Welke breincel in jouw hoofd dacht dat het grappig was om mij te pingen? Noem jij dat 'grappig'? Ik zal je godverdomme iets laten zien wat grappig is, ja. Ik neuk je moeder zo hard dat ze van me gaat houden, godverdomme. Dat krijg je er van als je me pingt, vuile teringleijer. Jouw soort mag wat mij betreft uitsterven. Weet je, ik ga je helemaal geen aandacht meer geven. Je mag de tering krijgen, en daar blijft het bij. Kutjong.",
|
|
||||||
self.getResponseForMessageLocal("stroopwafel")
|
self.getResponseForMessageLocal("stroopwafel")
|
||||||
]
|
]
|
||||||
try:
|
try:
|
||||||
@@ -292,7 +291,9 @@ class Chatbot(commands.Cog):
|
|||||||
if random.random() > 0.9:
|
if random.random() > 0.9:
|
||||||
try:
|
try:
|
||||||
# GPT request moet echt even in een non-blocking executortje, anders loopt de hele boel vast
|
# GPT request moet echt even in een non-blocking executortje, anders loopt de hele boel vast
|
||||||
return await self.bot.loop.run_in_executor(None,self.getResponseForMessageOnline, wordsToRespondTo)
|
response = await self.bot.loop.run_in_executor(None,self.getResponseForMessageOnline, wordsToRespondTo)
|
||||||
|
if response:
|
||||||
|
return response # Anders door naar local
|
||||||
except:
|
except:
|
||||||
pass # Door naar local call
|
pass # Door naar local call
|
||||||
return self.getResponseForMessageLocal(wordsToRespondTo)
|
return self.getResponseForMessageLocal(wordsToRespondTo)
|
||||||
@@ -303,8 +304,11 @@ class Chatbot(commands.Cog):
|
|||||||
return req.json()["translations"][0]["text"]
|
return req.json()["translations"][0]["text"]
|
||||||
|
|
||||||
def getResponseForMessageOnline(self, wordsToRespondTo):
|
def getResponseForMessageOnline(self, wordsToRespondTo):
|
||||||
text = self.translateTo("en", " ".join(wordsToRespondTo))
|
prompt = " ".join(wordsToRespondTo)
|
||||||
req = requests.post('http://gpt.hoekveen.net/complete', json={"prompt": text, "max_tokens": 60})
|
if not prompt:
|
||||||
|
prompt = self.getResponseForMessageLocal([])
|
||||||
|
text = self.translateTo("en", prompt)
|
||||||
|
req = requests.post('http://gpt.hoekveen.net/complete', json={"prompt": text, "max_tokens": 80})
|
||||||
print(req.json())
|
print(req.json())
|
||||||
respons = req.json()["text"]
|
respons = req.json()["text"]
|
||||||
respons = respons[0:respons.rfind(".")+1] # Alles weg na de laatste punt
|
respons = respons[0:respons.rfind(".")+1] # Alles weg na de laatste punt
|
||||||
|
|||||||
+8
-10
@@ -197,8 +197,7 @@ class Cryptocoin(commands.Cog):
|
|||||||
#user functions below
|
#user functions below
|
||||||
|
|
||||||
@commands.command(pass_context=True)
|
@commands.command(pass_context=True)
|
||||||
@asyncio.coroutine
|
async def coinprice(self, ctx, coinId: str, currencyId: str="USD"):
|
||||||
def coinprice(self, ctx, coinId: str, currencyId: str="USD"):
|
|
||||||
"""Geeft de huidige prijs van de desbetreffende crypto currency
|
"""Geeft de huidige prijs van de desbetreffende crypto currency
|
||||||
Bijv:
|
Bijv:
|
||||||
!coinprice BTC
|
!coinprice BTC
|
||||||
@@ -211,20 +210,19 @@ class Cryptocoin(commands.Cog):
|
|||||||
currencyId = currencyId.upper()
|
currencyId = currencyId.upper()
|
||||||
|
|
||||||
if (currencyId not in allowedCurrencies):
|
if (currencyId not in allowedCurrencies):
|
||||||
yield from ctx.channel.send("Valuta " + currencyId + " ken ik niet. :disappointed: ")
|
await ctx.channel.send("Valuta " + currencyId + " ken ik niet. :disappointed: ")
|
||||||
return
|
return
|
||||||
|
|
||||||
price = self.getCoinPrice(coinId, currencyId)
|
price = self.getCoinPrice(coinId, currencyId)
|
||||||
|
|
||||||
if (price == -1):
|
if (price == -1):
|
||||||
yield from ctx.channel.send("Die cryptocoin ken ik niet... :frowning2: ")
|
await ctx.channel.send("Die cryptocoin ken ik niet... :frowning2: ")
|
||||||
return
|
return
|
||||||
|
|
||||||
yield from ctx.channel.send(coinId + " is nu " + str(price) + " " + currencyId + " waard.")
|
await ctx.channel.send(coinId + " is nu " + str(price) + " " + currencyId + " waard.")
|
||||||
|
|
||||||
@commands.command(pass_context=True)
|
@commands.command(pass_context=True)
|
||||||
@asyncio.coroutine
|
async def coinadvice(self, ctx, coinId: str=""):
|
||||||
def coinadvice(self, ctx, coinId: str=""):
|
|
||||||
"""Voor al uw adviezen in monopolygeld
|
"""Voor al uw adviezen in monopolygeld
|
||||||
Vraag Stroop's mening over een specifieke coin:
|
Vraag Stroop's mening over een specifieke coin:
|
||||||
!coinadvice NLG
|
!coinadvice NLG
|
||||||
@@ -237,7 +235,7 @@ class Cryptocoin(commands.Cog):
|
|||||||
|
|
||||||
#Geen specieke coin? Doe random.
|
#Geen specieke coin? Doe random.
|
||||||
if(coinId == ""):
|
if(coinId == ""):
|
||||||
yield from ctx.channel.send( self.getRandomCoinAdvice() )
|
await ctx.channel.send( self.getRandomCoinAdvice() )
|
||||||
return
|
return
|
||||||
|
|
||||||
coinId = coinId.upper()
|
coinId = coinId.upper()
|
||||||
@@ -245,7 +243,7 @@ class Cryptocoin(commands.Cog):
|
|||||||
growPercentage, coinStability, dummy = self.analyseCoin(coinId)
|
growPercentage, coinStability, dummy = self.analyseCoin(coinId)
|
||||||
|
|
||||||
if (growPercentage == 0 and coinStability == 1.0): #aanname. anders moet je weer een extra call doen.
|
if (growPercentage == 0 and coinStability == 1.0): #aanname. anders moet je weer een extra call doen.
|
||||||
yield from ctx.channel.send("Die cryptocoin ken ik niet... :frowning2: ")
|
await ctx.channel.send("Die cryptocoin ken ik niet... :frowning2: ")
|
||||||
return
|
return
|
||||||
|
|
||||||
time.sleep(0.1) #don't overload the API
|
time.sleep(0.1) #don't overload the API
|
||||||
@@ -302,5 +300,5 @@ class Cryptocoin(commands.Cog):
|
|||||||
if (coinStability < 0.3):
|
if (coinStability < 0.3):
|
||||||
message += "Denk ik?"
|
message += "Denk ik?"
|
||||||
|
|
||||||
yield from ctx.channel.send(message)
|
await ctx.channel.send(message)
|
||||||
|
|
||||||
+46
-5
@@ -5,6 +5,7 @@ import random
|
|||||||
import re
|
import re
|
||||||
import json, requests
|
import json, requests
|
||||||
import warnings
|
import warnings
|
||||||
|
from datetime import date, timedelta
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
|
||||||
class General(commands.Cog):
|
class General(commands.Cog):
|
||||||
@@ -12,7 +13,7 @@ class General(commands.Cog):
|
|||||||
|
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
self.muzak_url = 'https://hdcon-muzak.herokuapp.com'
|
self.muzak_url = 'https://muzak.hoekveen.net'
|
||||||
self.r = praw.Reddit(
|
self.r = praw.Reddit(
|
||||||
user_agent='StroopwafelBot',
|
user_agent='StroopwafelBot',
|
||||||
client_secret=os.getenv("STROOP_REDDIT_SECRET"),
|
client_secret=os.getenv("STROOP_REDDIT_SECRET"),
|
||||||
@@ -92,9 +93,49 @@ class General(commands.Cog):
|
|||||||
return requests.get(self.muzak_url + '/stroopwafel')
|
return requests.get(self.muzak_url + '/stroopwafel')
|
||||||
|
|
||||||
@commands.command(pass_context=True)
|
@commands.command(pass_context=True)
|
||||||
async def playlist(self, ctx):
|
async def muzak(self, ctx):
|
||||||
"""HDcon2021 playlist"""
|
"""HD muzak playlist"""
|
||||||
data = json.loads(self.get_playlist_json().content)
|
data = json.loads(self.get_playlist_json().content)
|
||||||
msg = 'Stemmen en nomineren kan hier: {}\n'.format(self.muzak_url)
|
msg = ""
|
||||||
msg += '*Er zijn al {} nummers genomineerd*\n'.format(data['stemCount'])
|
open = date.fromisoformat(data['openDate'])
|
||||||
|
nom = date.fromisoformat(data['deadlineNominations'])
|
||||||
|
vote = date.fromisoformat(data['deadlineVoting'])
|
||||||
|
today = date.today()
|
||||||
|
if open > today:
|
||||||
|
msg += "Het stemmen is nog niet geopend voor dit jaar.\n"
|
||||||
|
msg += f"Nog even geduld; Vanaf {open} is de muzak open en kun je naar hartelust stemmen en nomineren.\n"
|
||||||
|
elif today > nom and today > vote and (today - vote) < timedelta(days=8):
|
||||||
|
msg += "Het nomineren en stemmen is alweer voorbij.\n"
|
||||||
|
msg += "Je zult nog even geduld moeten hebben tot de lijst klaar is.\n"
|
||||||
|
elif today > nom and today > vote:
|
||||||
|
msg += "De lijst is al helemaal klaar. Goed gedaan jongens. Applausje voor jezelf."
|
||||||
|
else:
|
||||||
|
if open == today:
|
||||||
|
msg += "Jawel mensen! Vanaf vandaag mag het stemmen beginnen!\n"
|
||||||
|
msg += f"Stemmen en nomineren kan hier: {self.muzak_url}\n"
|
||||||
|
msg += f"*Er zijn al {data['stemCount']} nummers genomineerd!*\n"
|
||||||
|
msg += f"Nomineren kan tot {nom}, stemmen kan tot {vote}.\n"
|
||||||
|
msg += "\nIk hoop dat jullie allemaal je beste nummers insturen!"
|
||||||
await ctx.channel.send(msg)
|
await ctx.channel.send(msg)
|
||||||
|
|
||||||
|
@commands.command(pass_context=True)
|
||||||
|
async def pollen(self, ctx):
|
||||||
|
"Hoe veel last van pollen kun je verwachten?"
|
||||||
|
poll = 'https://app.everviz.com/embed/apyvera/' # Thanks hooikoortsradar
|
||||||
|
response = requests.get(poll)
|
||||||
|
if response:
|
||||||
|
# one-liner want eet stront
|
||||||
|
cijfer = float(re.findall(r";\d\.?\d?;", json.loads([x for x in response.text.splitlines() if "var options =" in x][0].partition("=")[2].strip(";, "))["data"]["csv"])[-1].strip(";"))
|
||||||
|
msg = ""
|
||||||
|
if cijfer < 3:
|
||||||
|
msg = f"Nou, het lijkt goed te gaan. Recentelijk gaven mensen hun klachten maar een {cijfer}. Lekker!"
|
||||||
|
elif cijfer < 6:
|
||||||
|
msg = f"Het lijkt allemaal mee te vallen. Men gaf hun klachten een {cijfer} deze week. Moet te doen zijn."
|
||||||
|
elif cijfer < 7.5:
|
||||||
|
msg = f"Ai. Het gaat lekker met de pollen, maar het ergste moet nog komen of is al geweest. Klachtencijfer van {cijfer}; Sterkte alvast."
|
||||||
|
else:
|
||||||
|
msg = f"Balen dit. Klachtencijfer van {cijfer}, dus bekijk het maar. Joe."
|
||||||
|
await ctx.channel.send(ctx.author.mention + ' ' + msg)
|
||||||
|
else:
|
||||||
|
await ctx.channel.send(ctx.author.mention + ' Er lijkt even geen klachtencijfer beschikbaar te zijn. Probeer het later nog eens')
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -43,20 +43,20 @@ class Shitpost(commands.Cog):
|
|||||||
|
|
||||||
@commands.command(pass_context=True, hidden=False)
|
@commands.command(pass_context=True, hidden=False)
|
||||||
async def ishetalhdcon(self, ctx):
|
async def ishetalhdcon(self, ctx):
|
||||||
"""Hoe lang nog tot Hoestende Draken Con 2022?
|
"""Hoe lang nog tot Hoestende Draken Con 2023?
|
||||||
Gebruik: !ishetalhdcon
|
Gebruik: !ishetalhdcon
|
||||||
"""
|
"""
|
||||||
|
|
||||||
Now = datetime.now()
|
Now = datetime.now()
|
||||||
HdConDate = datetime(2022, 10, 14, 4, 0, 1) #om 4 uur lig je toch wel al op bed?
|
HdConDate = datetime(2023, 10, 20, 4, 0, 1) #om 4 uur lig je toch wel al op bed?
|
||||||
Distance = HdConDate - Now
|
Distance = HdConDate - Now
|
||||||
Message = Message = "HD Con 2022 is al voorbij. HD Con 2023 zal in 2023 plaatsvinden."
|
Message = Message = "HD Con 2023 is al voorbij. HD Con 2024 zal in 2024 plaatsvinden."
|
||||||
if Distance.days == -1:
|
if Distance.days == -1:
|
||||||
Message = "HD Con 2022 begint vandaag! HYPE!"
|
Message = "HD Con 2023 begint vandaag! HYPE!"
|
||||||
elif Distance.days < 0 and Distance.days > -4:
|
elif Distance.days < 0 and Distance.days > -4:
|
||||||
Message = "HD Con 2022 is nu bezig!!"
|
Message = "HD Con 2023 is nu bezig!!"
|
||||||
elif Distance.days == -4:
|
elif Distance.days == -4:
|
||||||
Message = "HD Con 2022 is vandaag alweer afgelopen... F"
|
Message = "HD Con 2023 is vandaag alweer afgelopen... F"
|
||||||
|
|
||||||
if Distance.days < 0:
|
if Distance.days < 0:
|
||||||
await ctx.channel.send(ctx.author.mention + ' ' + str(Message))
|
await ctx.channel.send(ctx.author.mention + ' ' + str(Message))
|
||||||
|
|||||||
Reference in New Issue
Block a user