From 8ec62c188e5f0ef8a52609811b78e24df411af86 Mon Sep 17 00:00:00 2001 From: annihilator708 Date: Mon, 21 May 2018 04:53:36 +0200 Subject: [PATCH] What is a sebi bot without sebisauce? --- cogs.txt | 3 ++- src/cogs/fun.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 src/cogs/fun.py diff --git a/cogs.txt b/cogs.txt index 5069854..2f73a9d 100644 --- a/cogs.txt +++ b/cogs.txt @@ -1,3 +1,4 @@ example upload -git \ No newline at end of file +git +fun \ No newline at end of file diff --git a/src/cogs/fun.py b/src/cogs/fun.py new file mode 100644 index 0000000..d2295ac --- /dev/null +++ b/src/cogs/fun.py @@ -0,0 +1,42 @@ +#!/usr/bin/python +# -*- coding: -*- + +from discord.ext import commands +import discord +import random + +class Fun: + """ + CogName should be the name of the cog + """ + def __init__(self, bot): + self.bot = bot + + @commands.command() + async def sebisauce(self, ctx): + """ + Get a image related to Sebi. + Sebi is a random guy with perfect code related jokes. + + Usage: + - sebisauce + """ + await ctx.trigger_typing() + source = await self.bot.brequest.aio_json('http://ikbengeslaagd.com/API/sebisauce.json') + + total_sebi = 0 + for key in dict.keys(source): + total_sebi += 1 + + im = random.randint(0, int(total_sebi) - 1) + + msg = await ctx.send( + embed=discord.Embed( + title='\t', + description='\t', + color=0xf20006).set_image( + url=source[str(im)])) + return await msg.add_reaction(self.bot.success) + +def setup(bot): + bot.add_cog(Fun(bot))