-
Notifications
You must be signed in to change notification settings - Fork 0
Inspirobot Function
After several hours of the course of a day or two, I'd finally found the right tools to implement Inspirobot's API into my bot for my users to play with. I'm happy I did so, as this is easily the most used 'fun' feature. However the road in getting there was hard as hell.
I came across several repositories in which I could take inspiration
there were of course a few other sources that had popped up at the time, particularly in .Js and Dart; but I'm not going to link those nor did I dive into looking at them more than a few moments. My primary inspiration came from inspirobot itself ofc, and then the repositories I looked through thereafter.
The inspiro.py wrapper works flawlessly, especially asynchronously. My users quite literally able to spam the command as often as they'd like (within the parameters of my cooldown)
@commands.command(help="Gives you an inspirational quote"
" for to help you throughout the day.",
aliases=["insp",
"spire",
"motivate"])
@commands.cooldown(1, 3, commands.BucketType.user)
async def inspire(self, ctx):
try:
quote = inspirobot.generate()
e = discord.Embed(title=":eye::lips::eye: | Inspiration :sparkles:",
colour=discord.Colour.random()
)
e.set_image(url=quote.url)
await ctx.reply(embed=e)
except:
pass
@commands.command(aliases=["flow",
"fq",
"flow_quotes"],
help="offers inspirational flow quotes")
async def flow_q(self, ctx):
flow = inspirobot.flow()
for quote in flow:
await ctx.send(quote.text, tts=True)