Added .gitignore, Added Inspirobot

This commit is contained in:
Robert 2020-01-07 04:07:39 +01:00
parent ca91cfddaf
commit 2f16876177
5 changed files with 61 additions and 8 deletions

23
cogs/api/inspirobot.py Normal file
View file

@ -0,0 +1,23 @@
import discord
from discord.ext import commands
from api import inspirobot
class Inspirobot(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command(name="Inspirobot", description="Sends a randomly generated inspirational quote", aliases=["inspiration", "inspiro"])
@commands.cooldown(1, 5)
async def inspirobot(self, ctx):
image = inspirobot.get_inspirational_quote()
if image is None:
await ctx.message.add_reaction("⚠️")
else:
embed = discord.Embed(title="InspiroBot", color=0x111387)
embed.set_image(url=image)
await ctx.send(embed=embed)
def setup(client):
client.add_cog(Inspirobot(client))

View file

@ -11,11 +11,13 @@ class Steam(commands.Cog):
@commands.cooldown(1, 2)
async def SteamLevel(self, ctx, vanity_url):
level = steam.get_steam_level(vanity_url)
percentile = round(float(steam.get_steam_level_distribution(level)), 2)
if level is not None:
await ctx.send(f"{vanity_url} is level {level}! This makes him better than {percentile}% of Steam users!")
else:
if level is None:
await ctx.send(f"There is nobody named \"{vanity_url}\" on Steam, or their profile might be pivate.")
else:
percentile = round(float(steam.get_steam_level_distribution(level)), 2)
await ctx.send(f"{vanity_url} is level {level}! This makes him better than {percentile}% of Steam users!")