2
0
mirror of https://github.com/Nick80835/microbot synced 2025-08-28 21:18:34 +00:00

add random useless facts

This commit is contained in:
Nick80835 2020-06-17 13:24:29 -04:00
parent 0af4d4ec61
commit c38aeec342

View File

@ -136,6 +136,18 @@ async def dadjoke(event):
await event.reply(dad_joke)
@ldr.add("fact")
async def randomfact(event):
async with ldr.aioclient.get("https://uselessfacts.jsph.pl/random.json", params={"language": "en"}) as response:
if response.status == 200:
random_fact = (await response.json())["text"].replace("`", "'")
else:
await event.reply(f"An error occured: **{response.status}**")
return
await event.reply(random_fact)
async def shitpostify(text):
text = text.replace("dick", "peepee")
text = text.replace("ck", "cc")