mirror of
https://github.com/RafaelSolVargas/Vulkan.git
synced 2025-10-29 16:57:23 +00:00
Adding types and changing some messages from class
This commit is contained in:
@@ -1,30 +1,30 @@
|
||||
from random import randint, random
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
from discord import Client
|
||||
from discord.ext.commands import Context, command, Cog
|
||||
from Config.Colors import Colors
|
||||
from Config.Config import Configs
|
||||
from Config.Helper import Helper
|
||||
from Views.Embeds import Embeds
|
||||
|
||||
helper = Helper()
|
||||
|
||||
|
||||
class Random(commands.Cog):
|
||||
class Random(Cog):
|
||||
|
||||
def __init__(self, bot):
|
||||
self.__bot = bot
|
||||
def __init__(self, bot: Client):
|
||||
self.__config = Configs()
|
||||
self.__colors = Colors()
|
||||
self.__embeds = Embeds()
|
||||
|
||||
@commands.command(name='random', help=helper.HELP_RANDOM, description=helper.HELP_RANDOM_LONG)
|
||||
async def random(self, ctx, arg: str) -> None:
|
||||
@command(name='random', help=helper.HELP_RANDOM, description=helper.HELP_RANDOM_LONG)
|
||||
async def random(self, ctx: Context, arg: str) -> None:
|
||||
try:
|
||||
arg = int(arg)
|
||||
|
||||
except:
|
||||
embed = discord.Embed(
|
||||
description=self.__config.ERROR_NUMBER,
|
||||
colour=self.__config.COLOURS['red']
|
||||
)
|
||||
embed = self.__embeds.ERROR_NUMBER()
|
||||
await ctx.send(embed=embed)
|
||||
return
|
||||
return None
|
||||
|
||||
if arg < 1:
|
||||
a = arg
|
||||
@@ -34,29 +34,21 @@ class Random(commands.Cog):
|
||||
b = arg
|
||||
|
||||
x = randint(a, b)
|
||||
embed = discord.Embed(
|
||||
title=f'Random number between [{a, b}]',
|
||||
description=x,
|
||||
colour=self.__config.COLOURS['green']
|
||||
)
|
||||
embed = self.__embeds.RANDOM_NUMBER(a, b, x)
|
||||
await ctx.send(embed=embed)
|
||||
|
||||
@commands.command(name='cara', help=helper.HELP_CARA, description=helper.HELP_CARA_LONG)
|
||||
async def cara(self, ctx) -> None:
|
||||
@command(name='cara', help=helper.HELP_CARA, description=helper.HELP_CARA_LONG)
|
||||
async def cara(self, ctx: Context) -> None:
|
||||
x = random()
|
||||
if x < 0.5:
|
||||
result = 'cara'
|
||||
else:
|
||||
result = 'coroa'
|
||||
|
||||
embed = discord.Embed(
|
||||
title='Cara Cora',
|
||||
description=f'Result: {result}',
|
||||
colour=self.__config.COLOURS['green']
|
||||
)
|
||||
embed = self.__embeds.CARA_COROA(result)
|
||||
await ctx.send(embed=embed)
|
||||
|
||||
@commands.command(name='choose', help=helper.HELP_CHOOSE, description=helper.HELP_CHOOSE_LONG)
|
||||
@command(name='choose', help=helper.HELP_CHOOSE, description=helper.HELP_CHOOSE_LONG)
|
||||
async def choose(self, ctx, *args: str) -> None:
|
||||
try:
|
||||
user_input = " ".join(args)
|
||||
@@ -64,18 +56,10 @@ class Random(commands.Cog):
|
||||
|
||||
index = randint(0, len(itens)-1)
|
||||
|
||||
embed = discord.Embed(
|
||||
title='Choose something',
|
||||
description=itens[index],
|
||||
colour=self.__config.COLOURS['green']
|
||||
)
|
||||
embed = self.__embeds.CHOSEN_THING(itens[index])
|
||||
await ctx.send(embed=embed)
|
||||
except:
|
||||
embed = discord.Embed(
|
||||
title='Choose something.',
|
||||
description=f'Error: Use {self.__config.BOT_PREFIX}help choose to understand this command.',
|
||||
colour=self.__config.COLOURS['red']
|
||||
)
|
||||
embed = self.__embeds.BAD_CHOOSE_USE()
|
||||
await ctx.send(embed=embed)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user