mirror of
https://github.com/RafaelSolVargas/Vulkan.git
synced 2025-10-29 16:57:23 +00:00
Stylish update
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from discord.client import Client
|
||||
import requests
|
||||
import json
|
||||
from config import config
|
||||
@@ -8,20 +9,12 @@ from random import random as rand
|
||||
class Phrases(commands.Cog):
|
||||
"""Deal with the generation of motivational phrases"""
|
||||
|
||||
def __init__(self, bot):
|
||||
def __init__(self, bot: Client):
|
||||
self.__bot = bot
|
||||
|
||||
@property
|
||||
def bot(self):
|
||||
return self.__bot
|
||||
|
||||
@bot.setter
|
||||
def bot(self, newBot):
|
||||
self.__bot = newBot
|
||||
|
||||
@commands.command(name='frase', help='Envia uma frase pica, talvez a braba')
|
||||
@commands.command(name='frase', help=config.HELP_FRASE)
|
||||
async def phrase(self, ctx):
|
||||
# There is a chance that the phrase will be send for the dev
|
||||
"""Send some phrase to the requester"""
|
||||
secret = await self.__calculate_rgn()
|
||||
if secret != None:
|
||||
await ctx.send(secret)
|
||||
@@ -30,6 +23,7 @@ class Phrases(commands.Cog):
|
||||
await ctx.send(phrase)
|
||||
|
||||
async def __calculate_rgn(self):
|
||||
"""Calculate the chance from the phrase function return a secret custom message"""
|
||||
x = rand()
|
||||
if x < 0.15:
|
||||
return config.SECRET_MESSAGE
|
||||
@@ -37,6 +31,7 @@ class Phrases(commands.Cog):
|
||||
return None
|
||||
|
||||
async def __get_phrase(self):
|
||||
"""Get the phrase from the server"""
|
||||
tries = 0
|
||||
while True:
|
||||
tries += 1
|
||||
@@ -50,7 +45,7 @@ class Phrases(commands.Cog):
|
||||
phrase = data['quoteText']
|
||||
author = data['quoteAuthor']
|
||||
|
||||
if phrase == '' or author == '': # Don't accept incomplete phrases
|
||||
if phrase == '' or author == '':
|
||||
continue
|
||||
|
||||
text = f'{phrase} \nBy: {author}'
|
||||
|
||||
@@ -3,14 +3,13 @@ import discord
|
||||
from discord.ext import commands
|
||||
from config import config
|
||||
|
||||
|
||||
class Random(commands.Cog):
|
||||
"""Deal with returning random things"""
|
||||
|
||||
def __init__(self, bot):
|
||||
self.__bot = bot
|
||||
|
||||
@commands.command(name='random', help='Número aleatório de 1 a X')
|
||||
@commands.command(name='random', help=config.HELP_RANDOM)
|
||||
async def random(self, ctx, arg: str):
|
||||
try:
|
||||
arg = int(arg)
|
||||
@@ -38,7 +37,7 @@ class Random(commands.Cog):
|
||||
)
|
||||
await ctx.send(embed=embed)
|
||||
|
||||
@commands.command(name='cara', help='coroa')
|
||||
@commands.command(name='cara', help=config.HELP_CARA)
|
||||
async def cara(self, ctx):
|
||||
x = random()
|
||||
if x < 0.5:
|
||||
@@ -53,7 +52,7 @@ class Random(commands.Cog):
|
||||
)
|
||||
await ctx.send(embed=embed)
|
||||
|
||||
@commands.command(name='escolha', help='Escolhe um dos itens, separador: Vírgula')
|
||||
@commands.command(name='escolha', help=config.HELP_ESCOLHA)
|
||||
async def escolher(self, ctx, *args: str):
|
||||
try:
|
||||
user_input = " ".join(args)
|
||||
|
||||
@@ -13,13 +13,14 @@ class Warframe(commands.Cog):
|
||||
self.__bot = bot
|
||||
self.__open_functions = ['cetus', 'cambion', 'fissures']
|
||||
|
||||
@commands.command(name='warframe', help='<x> - Retorna informações de x')
|
||||
async def warframe(self, ctx, arg):
|
||||
@commands.command(name='warframe', help=config.HELP_WARFRAME)
|
||||
async def warframe(self, ctx, arg) -> Embed:
|
||||
if arg in self.__open_functions:
|
||||
function = getattr(Warframe, f'_Warframe__{arg}') # Get the required function
|
||||
embed = await function(self) # Execute the function passing self
|
||||
# Get the required function
|
||||
function = getattr(Warframe, f'_Warframe__{arg}')
|
||||
embed = await function(self) # Execute the function passing self
|
||||
|
||||
await ctx.send(embed=embed) # Return the result
|
||||
await ctx.send(embed=embed) # Return the result
|
||||
else:
|
||||
info = f'Warframe commands: {self.__open_functions}'
|
||||
|
||||
@@ -29,7 +30,7 @@ class Warframe(commands.Cog):
|
||||
colour=config.COLOURS['blue']
|
||||
)
|
||||
await ctx.send(embed=embed)
|
||||
|
||||
|
||||
async def __cetus(self) -> Embed:
|
||||
description = await self.__get_cetus()
|
||||
embed = discord.Embed(
|
||||
@@ -39,7 +40,7 @@ class Warframe(commands.Cog):
|
||||
)
|
||||
return embed
|
||||
|
||||
async def __get_cetus(self):
|
||||
async def __get_cetus(self) -> str:
|
||||
"""Return the information of the Warframe API"""
|
||||
tries = 0
|
||||
while True:
|
||||
@@ -56,7 +57,7 @@ class Warframe(commands.Cog):
|
||||
|
||||
except Exception as e:
|
||||
continue
|
||||
|
||||
|
||||
async def __cambion(self) -> Embed:
|
||||
description = await self.__get_cambion()
|
||||
embed = discord.Embed(
|
||||
@@ -66,7 +67,7 @@ class Warframe(commands.Cog):
|
||||
)
|
||||
return embed
|
||||
|
||||
async def __get_cambion(self):
|
||||
async def __get_cambion(self) -> str:
|
||||
"""Return the information of the Warframe API"""
|
||||
tries = 0
|
||||
while True:
|
||||
@@ -79,7 +80,7 @@ class Warframe(commands.Cog):
|
||||
data = json.loads(response.content)
|
||||
|
||||
info = f'**Active:** {data["active"]}\n**Time Left:** {data["timeLeft"]}'
|
||||
|
||||
|
||||
return info
|
||||
except Exception as e:
|
||||
print(e)
|
||||
@@ -94,7 +95,7 @@ class Warframe(commands.Cog):
|
||||
)
|
||||
return embed
|
||||
|
||||
async def __get_fissures(self):
|
||||
async def __get_fissures(self) -> str:
|
||||
"""Return the information of the Warframe API"""
|
||||
tries = 0
|
||||
while True:
|
||||
@@ -105,11 +106,11 @@ class Warframe(commands.Cog):
|
||||
try:
|
||||
response = requests.get(config.FISSURES_API)
|
||||
data = json.loads(response.content)
|
||||
|
||||
|
||||
info = ''
|
||||
for pos, fissure in enumerate(data, start=1):
|
||||
info += f'`{pos}` - **Mission:** {fissure["missionType"]} | **Type:** {fissure["tier"]} | **Timing:** {fissure["eta"]} | **Storm:** {fissure["isStorm"]}\n'
|
||||
|
||||
|
||||
return info
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
Reference in New Issue
Block a user