mirror of
https://github.com/wlinator/luminara.git
synced 2024-10-02 18:03:12 +00:00
HUGE UPDATE & only load economy module for now
This commit is contained in:
parent
4ce26cdc92
commit
9a0e522bac
17 changed files with 840 additions and 557 deletions
53
lib/embeds/error.py
Normal file
53
lib/embeds/error.py
Normal file
|
@ -0,0 +1,53 @@
|
|||
import discord
|
||||
from lib import formatter
|
||||
|
||||
question_icon = "https://i.imgur.com/8xccUws.png"
|
||||
|
||||
|
||||
def clean_error_embed():
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.red()
|
||||
)
|
||||
|
||||
return embed
|
||||
|
||||
|
||||
class EconErrors:
|
||||
@staticmethod
|
||||
def missing_bet(ctx):
|
||||
"""
|
||||
See MissingRequiredArgument
|
||||
"""
|
||||
embed = clean_error_embed()
|
||||
embed.description = f"**{ctx.author.name}** please enter a bet."
|
||||
embed.set_footer(text=f"For more info do '{formatter.get_prefix(ctx)}help {formatter.get_invoked_name(ctx)}'",
|
||||
icon_url=question_icon)
|
||||
return embed
|
||||
|
||||
@staticmethod
|
||||
def bad_bet_argument(ctx):
|
||||
"""
|
||||
See BadArgument
|
||||
"""
|
||||
embed = clean_error_embed()
|
||||
embed.description = f"**{ctx.author.name}** the bet you entered is invalid."
|
||||
embed.set_footer(text=f"For more info do '{formatter.get_prefix(ctx)}help {formatter.get_invoked_name(ctx)}'",
|
||||
icon_url=question_icon)
|
||||
return embed
|
||||
|
||||
@staticmethod
|
||||
def insufficient_balance(ctx):
|
||||
embed = clean_error_embed()
|
||||
embed.description = f"**{ctx.author.name}** you don't have enough cash."
|
||||
embed.set_footer(text=f"Do '{formatter.get_prefix(ctx)}balance' to see how much you can spend",
|
||||
icon_url=question_icon)
|
||||
return embed
|
||||
|
||||
@staticmethod
|
||||
def daily_already_claimed(ctx, unix_time):
|
||||
embed = clean_error_embed()
|
||||
embed.description = f"**{ctx.author.name}** already claimed. You can claim your reward again <t:{unix_time}:R>."
|
||||
embed.set_footer(text=f"For more info do '{formatter.get_prefix(ctx)}help {formatter.get_invoked_name(ctx)}'",
|
||||
icon_url=question_icon)
|
||||
|
||||
return embed
|
18
lib/embeds/info.py
Normal file
18
lib/embeds/info.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
import discord
|
||||
|
||||
exclam_icon = "https://i.imgur.com/vitwMUu.png"
|
||||
|
||||
|
||||
class EconInfo:
|
||||
@staticmethod
|
||||
def daily_reward_claimed(ctx, formatted_amount, streak):
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.brand_green(),
|
||||
description=f"**{ctx.author.name}** you claimed your reward of **${formatted_amount}**!"
|
||||
)
|
||||
|
||||
if streak > 1:
|
||||
embed.set_footer(text=f"You're on a streak of {streak} days",
|
||||
icon_url=exclam_icon)
|
||||
|
||||
return embed
|
123
lib/embeds_old.py
Normal file
123
lib/embeds_old.py
Normal file
|
@ -0,0 +1,123 @@
|
|||
import discord
|
||||
|
||||
from lib import formatter
|
||||
from services.Xp import Xp
|
||||
|
||||
|
||||
def welcome_message(member, template=None):
|
||||
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.embed_background(),
|
||||
description=f"_ _\n**Welcome** to **{member.guild.name}**"
|
||||
)
|
||||
|
||||
if template:
|
||||
embed.description += "↓↓↓\n" + formatter.template(template, member.name)
|
||||
|
||||
embed.set_thumbnail(url=member.display_avatar)
|
||||
|
||||
return embed
|
||||
|
||||
|
||||
def command_error_1(error):
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.red(),
|
||||
description=f"Something went wrong.\n```{error}```"
|
||||
)
|
||||
|
||||
return embed
|
||||
|
||||
|
||||
def simple_question_5(question):
|
||||
embed = discord.Embed(color=0xadcca6,
|
||||
title=question)
|
||||
|
||||
embed.set_footer(text="max. 5 characters")
|
||||
return embed
|
||||
|
||||
|
||||
def simple_question_30(question):
|
||||
embed = discord.Embed(color=0xadcca6,
|
||||
title=question)
|
||||
|
||||
embed.set_footer(text="max. 30 characters")
|
||||
return embed
|
||||
|
||||
|
||||
def simple_question_100(question):
|
||||
embed = discord.Embed(color=0xadcca6,
|
||||
title=question)
|
||||
|
||||
embed.set_footer(text="max. 100 characters")
|
||||
return embed
|
||||
|
||||
|
||||
def simple_question_300(question):
|
||||
embed = discord.Embed(color=0xadcca6,
|
||||
title=question)
|
||||
|
||||
embed.set_footer(text="max. 300 characters")
|
||||
return embed
|
||||
|
||||
|
||||
def simple_question_none(question):
|
||||
embed = discord.Embed(color=0xadcca6,
|
||||
title=question)
|
||||
return embed
|
||||
|
||||
|
||||
def simple_question_first(question):
|
||||
embed = discord.Embed(color=0xadcca6,
|
||||
title=f"You chose to go with the short introduction! "
|
||||
f"Let's start with your nickname. {question}")
|
||||
embed.set_footer(text="max. 100 characters")
|
||||
return embed
|
||||
|
||||
|
||||
def simple_question_first_extended(question):
|
||||
embed = discord.Embed(color=0xadcca6,
|
||||
title=f"You chose to go with the extended introduction! "
|
||||
f"Let's start with your nickname. {question}")
|
||||
embed.set_footer(text="max. 100 characters")
|
||||
return embed
|
||||
|
||||
|
||||
def no_time():
|
||||
embed = discord.Embed(description="You ran out of time or clicked the \"Stop\" button. "
|
||||
"If you wish to start over, do **/intro**.")
|
||||
return embed
|
||||
|
||||
|
||||
def final_embed_short(ctx, nickname, age, location, pronouns, likes, dislikes):
|
||||
embed = discord.Embed(color=0x2200FF, description=
|
||||
f"**(Nick)name:** {nickname}\n\n**Age:** {age}\n\n"
|
||||
f"**Region:** {location}\n\n**Pronouns:** {pronouns}\n\n"
|
||||
f"**Likes & interests:** {likes}\n\n**Dislikes:** {dislikes}")
|
||||
|
||||
embed.set_author(name=ctx.author.name, icon_url=ctx.author.avatar.url)
|
||||
embed.set_footer(text="Type: Short Introduction")
|
||||
|
||||
return embed
|
||||
|
||||
|
||||
def final_embed_extended(ctx, nickname, age, location, languages, pronouns,
|
||||
sexuality, relationship_status, likes, dislikes, extra):
|
||||
embed = discord.Embed(color=0xD91E1E, description=
|
||||
f"**(Nick)name:** {nickname}\n\n**Age:** {age}\n\n"
|
||||
f"**Region:** {location}\n\n**Languages:** {languages}\n\n"
|
||||
f"**Pronouns:** {pronouns}\n\n**Sexuality** {sexuality}\n\n"
|
||||
f"**Relationship status:** {relationship_status}\n\n**Likes & interests:** {likes}\n\n"
|
||||
f"**Dislikes:** {dislikes}\n\n**EXTRAS:** {extra}")
|
||||
|
||||
embed.set_author(name=ctx.author.name, icon_url=ctx.author.avatar.url)
|
||||
embed.set_footer(text="Type: Extended Introduction")
|
||||
|
||||
return embed
|
||||
|
||||
|
||||
def final_confirmation(channel_id):
|
||||
embed = discord.Embed(color=0xadcca6,
|
||||
title="Your introduction has been posted in the server!",
|
||||
description=f"<#{channel_id}>")
|
||||
|
||||
return embed
|
|
@ -1,3 +1,6 @@
|
|||
import discord
|
||||
|
||||
|
||||
def template(text, username, level=None):
|
||||
"""
|
||||
Replaces placeholders in the given text with actual values.
|
||||
|
@ -19,3 +22,27 @@ def template(text, username, level=None):
|
|||
text = text.replace(placeholder, value)
|
||||
|
||||
return text
|
||||
|
||||
|
||||
def get_prefix(ctx):
|
||||
"""
|
||||
Attempt to get the prefix, if the command was used as a SlashCommand, return "/"
|
||||
"""
|
||||
try:
|
||||
prefix = ctx.clean_prefix
|
||||
except (discord.ApplicationCommandInvokeError, AttributeError):
|
||||
prefix = "/"
|
||||
|
||||
return prefix
|
||||
|
||||
|
||||
def get_invoked_name(ctx):
|
||||
"""
|
||||
Attempts to get the alias of the command used, if the user did a SlashCommand, return the name.
|
||||
"""
|
||||
try:
|
||||
invoked_with = ctx.invoked_with
|
||||
except (discord.ApplicationCommandInvokeError, AttributeError):
|
||||
invoked_with = ctx.command.name
|
||||
|
||||
return invoked_with
|
||||
|
|
39
main.py
39
main.py
|
@ -7,7 +7,7 @@ import discord
|
|||
from discord.ext import commands, bridge
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from lib import embeds
|
||||
from lib import embeds_old
|
||||
from config import json_loader
|
||||
from handlers.ReactionHandler import ReactionHandler
|
||||
from handlers.XPHandler import XPHandler
|
||||
|
@ -77,7 +77,7 @@ async def on_member_join(member):
|
|||
):
|
||||
return
|
||||
|
||||
embed = embeds.welcome_message(member, config.welcome_message)
|
||||
embed = embeds_old.welcome_message(member, config.welcome_message)
|
||||
|
||||
try:
|
||||
await member.guild.get_channel(config.welcome_channel_id).send(embed=embed, content=member.mention)
|
||||
|
@ -157,36 +157,24 @@ strings = json_loader.load_strings()
|
|||
economy_config = json_loader.load_economy_config()
|
||||
reactions = json_loader.load_reactions()
|
||||
|
||||
# Keep track of loaded module filenames
|
||||
loaded_modules = set()
|
||||
|
||||
|
||||
def load_cogs():
|
||||
# sort modules alphabetically purely for an easier overview in logs
|
||||
for filename in sorted(os.listdir('./modules')):
|
||||
|
||||
if filename in loaded_modules:
|
||||
continue # module is already loaded
|
||||
|
||||
if filename.endswith('.py'):
|
||||
module_name = f'modules.{filename[:-3]}'
|
||||
|
||||
try:
|
||||
client.load_extension(module_name)
|
||||
loaded_modules.add(filename)
|
||||
logs.info(f"[MODULE] {filename[:-3].upper()} loaded.")
|
||||
|
||||
except Exception as e:
|
||||
logs.error(f"[MODULE] Failed to load module {filename}: {e}")
|
||||
|
||||
|
||||
def load_modules():
|
||||
modules_list = [
|
||||
"economy"
|
||||
]
|
||||
loaded_modules = set()
|
||||
|
||||
for module in modules_list:
|
||||
client.load_extension(f"modules.{module}")
|
||||
if module in loaded_modules:
|
||||
continue # module is already loaded
|
||||
|
||||
try:
|
||||
client.load_extension(f"modules.{module}")
|
||||
loaded_modules.add(module)
|
||||
logs.info(f"[MODULE] {module.upper()} loaded.")
|
||||
|
||||
except Exception as e:
|
||||
logs.error(f"[MODULE] Failed to load module {module.upper()}: {e}")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -198,7 +186,6 @@ if __name__ == '__main__':
|
|||
logs.info("RACU IS BOOTING")
|
||||
logs.info("\n")
|
||||
|
||||
#load_cogs()
|
||||
load_modules()
|
||||
|
||||
# empty line to separate modules from system info in logs
|
||||
|
|
|
@ -1,23 +1,13 @@
|
|||
import asyncio
|
||||
import logging
|
||||
import random
|
||||
|
||||
import discord
|
||||
from discord.ext import commands, bridge
|
||||
|
||||
from handlers.ItemHandler import ItemHandler
|
||||
from lib import economy_embeds, economy_functions, checks, interaction, embeds, err_embeds
|
||||
from main import economy_config, strings
|
||||
from modules.economy import leaderboard, blackjack, sell, slots, balance
|
||||
from services.BlackJackStats import BlackJackStats
|
||||
from services.Currency import Currency
|
||||
from services.Inventory import Inventory
|
||||
from services.Item import Item
|
||||
from services.SlotsStats import SlotsStats
|
||||
from services.Xp import Xp
|
||||
from lib import checks
|
||||
from lib.embeds.error import EconErrors
|
||||
from modules.economy import leaderboard, blackjack, sell, slots, balance, stats, give, inventory, daily
|
||||
|
||||
logs = logging.getLogger('Racu.Core')
|
||||
active_blackjack_games = {}
|
||||
|
||||
|
||||
class Economy(commands.Cog):
|
||||
|
@ -35,7 +25,7 @@ class Economy(commands.Cog):
|
|||
@commands.check(checks.channel)
|
||||
@commands.cooldown(1, 180, commands.BucketType.user)
|
||||
async def leaderboard_command(self, ctx):
|
||||
await leaderboard.cmd(ctx)
|
||||
return await leaderboard.cmd(ctx)
|
||||
|
||||
@bridge.bridge_command(
|
||||
name="balance",
|
||||
|
@ -47,7 +37,7 @@ class Economy(commands.Cog):
|
|||
)
|
||||
@commands.check(checks.channel)
|
||||
async def balance_command(self, ctx):
|
||||
await balance.cmd(ctx)
|
||||
return await balance.cmd(ctx)
|
||||
|
||||
@bridge.bridge_command(
|
||||
name="blackjack",
|
||||
|
@ -58,185 +48,28 @@ class Economy(commands.Cog):
|
|||
)
|
||||
@commands.check(checks.channel)
|
||||
async def blackjack_command(self, ctx, *, bet: int):
|
||||
|
||||
"""
|
||||
status states:
|
||||
0 = game start
|
||||
1 = player busted
|
||||
2 = player won with 21 (after hit)
|
||||
3 = dealer busted
|
||||
4 = dealer won
|
||||
5 = player won with 21 (blackjack)
|
||||
6 = timed out
|
||||
"""
|
||||
|
||||
# check if the player already has an active blackjack going
|
||||
if ctx.author.id in active_blackjack_games:
|
||||
await ctx.respond(embed=economy_embeds.already_playing("BlackJack"))
|
||||
return
|
||||
|
||||
# Currency handler
|
||||
ctx_currency = Currency(ctx.author.id)
|
||||
|
||||
# check if the user has enough cash
|
||||
player_balance = ctx_currency.balance
|
||||
if bet > player_balance:
|
||||
return await ctx.respond(embed=err_embeds.InsufficientBalance(ctx))
|
||||
elif bet <= 0:
|
||||
return await ctx.respond(embed=err_embeds.BadBetArgument(ctx))
|
||||
|
||||
# check if the bet exceeds the bet limit
|
||||
# bet_limit = int(economy_config["bet_limit"])
|
||||
# if abs(bet) > bet_limit:
|
||||
# message = strings["bet_limit"].format(ctx.author.name, Currency.format_human(bet_limit))
|
||||
# return await ctx.respond(content=message)
|
||||
|
||||
active_blackjack_games[ctx.author.id] = True
|
||||
|
||||
try:
|
||||
|
||||
player_hand = []
|
||||
dealer_hand = []
|
||||
deck = economy_functions.blackjack_get_new_deck()
|
||||
multiplier = float(economy_config["blackjack"]["reward_multiplier"])
|
||||
|
||||
# deal initial cards (player draws two & dealer one)
|
||||
player_hand.append(economy_functions.blackjack_deal_card(deck))
|
||||
player_hand.append(economy_functions.blackjack_deal_card(deck))
|
||||
dealer_hand.append(economy_functions.blackjack_deal_card(deck))
|
||||
|
||||
# calculate initial hands
|
||||
player_hand_value = economy_functions.blackjack_calculate_hand_value(player_hand)
|
||||
dealer_hand_value = economy_functions.blackjack_calculate_hand_value(dealer_hand)
|
||||
|
||||
status = 0 if player_hand_value != 21 else 5
|
||||
view = interaction.BlackJackButtons(ctx)
|
||||
playing_embed = False
|
||||
|
||||
while status == 0:
|
||||
if not playing_embed:
|
||||
await ctx.respond(embed=blackjack.blackjack_show(ctx, Currency.format_human(bet), player_hand,
|
||||
dealer_hand, player_hand_value,
|
||||
dealer_hand_value),
|
||||
view=view,
|
||||
content=ctx.author.mention)
|
||||
|
||||
playing_embed = True
|
||||
|
||||
await view.wait()
|
||||
|
||||
if view.clickedHit:
|
||||
# player draws a card & value is calculated
|
||||
player_hand.append(economy_functions.blackjack_deal_card(deck))
|
||||
player_hand_value = economy_functions.blackjack_calculate_hand_value(player_hand)
|
||||
|
||||
if player_hand_value > 21:
|
||||
status = 1
|
||||
break
|
||||
elif player_hand_value == 21:
|
||||
status = 2
|
||||
break
|
||||
|
||||
elif view.clickedStand:
|
||||
# player stands, dealer draws cards until he wins OR busts
|
||||
while dealer_hand_value <= player_hand_value:
|
||||
dealer_hand.append(economy_functions.blackjack_deal_card(deck))
|
||||
dealer_hand_value = economy_functions.blackjack_calculate_hand_value(dealer_hand)
|
||||
|
||||
if dealer_hand_value > 21:
|
||||
status = 3
|
||||
break
|
||||
else:
|
||||
status = 4
|
||||
break
|
||||
|
||||
else:
|
||||
status = 6
|
||||
break
|
||||
|
||||
# refresh
|
||||
view = interaction.BlackJackButtons(ctx)
|
||||
embed = blackjack.blackjack_show(ctx, Currency.format_human(bet), player_hand,
|
||||
dealer_hand, player_hand_value,
|
||||
dealer_hand_value)
|
||||
|
||||
await ctx.edit(embed=embed, view=view, content=ctx.author.mention)
|
||||
|
||||
"""
|
||||
At this point the game has concluded, generate a final output & backend
|
||||
"""
|
||||
payout = bet * multiplier if not status == 5 else bet * 2
|
||||
is_won = False if status == 1 or status == 4 else True
|
||||
|
||||
embed = blackjack.blackjack_finished(ctx, Currency.format_human(bet), player_hand_value,
|
||||
dealer_hand_value, Currency.format_human(payout), status)
|
||||
|
||||
item_reward = ItemHandler(ctx)
|
||||
field = await item_reward.rave_coin(is_won=is_won, bet=bet, field="")
|
||||
field = await item_reward.bitch_coin(status, field)
|
||||
|
||||
if field is not "":
|
||||
embed.add_field(name="Extra Rewards", value=field, inline=False)
|
||||
|
||||
if playing_embed:
|
||||
await ctx.edit(embed=embed, view=None, content=ctx.author.mention)
|
||||
else:
|
||||
await ctx.respond(embed=embed, view=None, content=ctx.author.mention)
|
||||
|
||||
# change balance
|
||||
# if status == 1 or status == 4:
|
||||
if not is_won:
|
||||
ctx_currency.take_balance(bet)
|
||||
ctx_currency.push()
|
||||
|
||||
# push stats (low priority)
|
||||
stats = BlackJackStats(
|
||||
user_id=ctx.author.id,
|
||||
is_won=False,
|
||||
bet=bet,
|
||||
payout=0,
|
||||
hand_player=player_hand,
|
||||
hand_dealer=dealer_hand
|
||||
)
|
||||
stats.push()
|
||||
|
||||
elif status == 6:
|
||||
await ctx.send(embed=economy_embeds.out_of_time(), content=ctx.author.mention)
|
||||
ctx_currency.take_balance(bet)
|
||||
ctx_currency.push()
|
||||
|
||||
else:
|
||||
ctx_currency.add_balance(payout)
|
||||
ctx_currency.push()
|
||||
|
||||
# push stats (low priority)
|
||||
stats = BlackJackStats(
|
||||
user_id=ctx.author.id,
|
||||
is_won=True,
|
||||
bet=bet,
|
||||
payout=payout,
|
||||
hand_player=player_hand,
|
||||
hand_dealer=dealer_hand
|
||||
)
|
||||
stats.push()
|
||||
|
||||
except Exception as e:
|
||||
await ctx.respond(embed=embeds.command_error_1(e))
|
||||
logs.error("[CommandHandler] Something went wrong in the gambling command: ", e)
|
||||
|
||||
finally:
|
||||
# remove player from active games list
|
||||
del active_blackjack_games[ctx.author.id]
|
||||
return await blackjack.cmd(ctx, bet)
|
||||
|
||||
@blackjack_command.error
|
||||
async def on_command_error(self, ctx, error):
|
||||
if isinstance(error, commands.MissingRequiredArgument):
|
||||
await ctx.respond(embed=err_embeds.MissingBet(ctx))
|
||||
await ctx.respond(embed=EconErrors.missing_bet(ctx))
|
||||
elif isinstance(error, commands.BadArgument):
|
||||
await ctx.respond(embed=err_embeds.BadBetArgument(ctx))
|
||||
await ctx.respond(embed=EconErrors.bad_bet_argument(ctx))
|
||||
else:
|
||||
raise error
|
||||
|
||||
@bridge.bridge_command(
|
||||
name="daily",
|
||||
aliases=["timely"],
|
||||
description="Claim your daily cash!",
|
||||
help="Claim your daily reward! The daily reset is at 7 AM EST.",
|
||||
guild_only=True
|
||||
)
|
||||
@commands.check(checks.channel)
|
||||
async def daily(self, ctx):
|
||||
return await daily.cmd(ctx)
|
||||
|
||||
@bridge.bridge_command(
|
||||
name="give",
|
||||
description="Give another user some currency.",
|
||||
|
@ -245,48 +78,7 @@ class Economy(commands.Cog):
|
|||
)
|
||||
@commands.check(checks.channel)
|
||||
async def give(self, ctx, *, user: discord.Member, amount: int):
|
||||
|
||||
if ctx.author.id == user.id:
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.red(),
|
||||
description=f"You can't give money to yourself, silly."
|
||||
)
|
||||
return await ctx.respond(embed=embed)
|
||||
elif user.bot:
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.red(),
|
||||
description=f"You can't give money to a bot, silly."
|
||||
)
|
||||
return await ctx.respond(embed=embed)
|
||||
|
||||
# Currency handler
|
||||
ctx_currency = Currency(ctx.author.id)
|
||||
target_currency = Currency(user.id)
|
||||
|
||||
try:
|
||||
author_balance = ctx_currency.balance
|
||||
|
||||
if author_balance < amount or author_balance <= 0:
|
||||
return await ctx.respond(embed=economy_embeds.not_enough_cash())
|
||||
|
||||
target_currency.add_balance(amount)
|
||||
ctx_currency.take_balance(amount)
|
||||
|
||||
ctx_currency.push()
|
||||
target_currency.push()
|
||||
|
||||
except Exception as e:
|
||||
await ctx.respond("Something funky happened.. Sorry about that.", ephemeral=True)
|
||||
print(e)
|
||||
return
|
||||
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.green(),
|
||||
description=f"**{ctx.author.name}** gave **${Currency.format(amount)}** to {user.name}."
|
||||
)
|
||||
embed.set_footer(text="Say thanks! :)")
|
||||
|
||||
await ctx.respond(embed=embed)
|
||||
return await give.cmd(ctx, user, amount)
|
||||
|
||||
@bridge.bridge_command(
|
||||
name="inventory",
|
||||
|
@ -297,33 +89,7 @@ class Economy(commands.Cog):
|
|||
)
|
||||
@commands.check(checks.channel)
|
||||
async def inventory(self, ctx):
|
||||
inventory = Inventory(ctx.author.id)
|
||||
inventory_dict = inventory.get_inventory()
|
||||
|
||||
description = "You don't have any items!" if inventory_dict == {} else None
|
||||
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.embed_background(),
|
||||
description=description
|
||||
)
|
||||
embed.set_author(name=ctx.author.name, icon_url=ctx.author.avatar.url)
|
||||
|
||||
for item, quantity in inventory_dict.items():
|
||||
if item.type == "badge":
|
||||
|
||||
if not embed.description:
|
||||
embed.description = "**Badges:** "
|
||||
|
||||
emote = self.client.get_emoji(item.emote_id)
|
||||
embed.description += f"{emote} "
|
||||
|
||||
else:
|
||||
emote = self.client.get_emoji(item.emote_id)
|
||||
embed.add_field(name=f"{emote} {item.display_name.capitalize()}",
|
||||
value=f"*— amount: `{quantity}`*",
|
||||
inline=False)
|
||||
|
||||
await ctx.respond(embed=embed)
|
||||
return await inventory.cmd(ctx)
|
||||
|
||||
@commands.slash_command(
|
||||
name="sell",
|
||||
|
@ -332,124 +98,7 @@ class Economy(commands.Cog):
|
|||
)
|
||||
@commands.check(checks.channel)
|
||||
async def sell_command(self, ctx):
|
||||
inv = Inventory(ctx.author.id)
|
||||
items = inv.get_sell_data()
|
||||
|
||||
def response_check(msg):
|
||||
return msg.author == ctx.author and msg.channel == ctx.channel
|
||||
|
||||
if not items:
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.red(),
|
||||
description="You don't have any items to sell."
|
||||
)
|
||||
return await ctx.respond(embed=embed)
|
||||
|
||||
options = sell.SellCommandOptions(items)
|
||||
view = sell.SellCommandView(ctx, options)
|
||||
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.embed_background(),
|
||||
description="Please select the item you want to sell."
|
||||
)
|
||||
await ctx.respond(embed=embed, view=view, content=ctx.author.mention)
|
||||
|
||||
await view.wait()
|
||||
item = view.item
|
||||
|
||||
if item:
|
||||
item = Item.get_item_by_display_name(view.item)
|
||||
quantity = item.get_quantity(ctx.author.id)
|
||||
|
||||
if quantity == 1:
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.embed_background(),
|
||||
description=f"You selected **{item.display_name}**, you have this item only once."
|
||||
)
|
||||
await ctx.edit(embed=embed)
|
||||
amount_to_sell = 1
|
||||
|
||||
elif quantity > 1:
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.embed_background(),
|
||||
description=f"You selected **{item.display_name}**, you have this item **{quantity}** times.\n"
|
||||
)
|
||||
embed.set_footer(text=f"Please type the amount you want to sell in this chat.")
|
||||
await ctx.edit(embed=embed)
|
||||
|
||||
try:
|
||||
amount_message = await self.client.wait_for('message', check=response_check, timeout=60)
|
||||
amount = amount_message.content
|
||||
|
||||
if sell.is_number_between(amount, quantity):
|
||||
amount_to_sell = int(amount)
|
||||
|
||||
else:
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.red(),
|
||||
description="Invalid input... try the command again."
|
||||
)
|
||||
return await ctx.respond(embed=embed, content=ctx.author.mention)
|
||||
|
||||
except asyncio.TimeoutError:
|
||||
await ctx.respond(
|
||||
embed=discord.Embed(description="You ran out of time.", color=discord.Color.red()),
|
||||
content=ctx.author.mention)
|
||||
# logs.warning(f"{ctx.author.id} Sell Timeout")
|
||||
return
|
||||
|
||||
else:
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.red(),
|
||||
description="You dont have this item."
|
||||
)
|
||||
embed.set_footer(text="It shouldn't have showed up in the list, my apologies.")
|
||||
return await ctx.edit(embed=embed)
|
||||
|
||||
"""
|
||||
Item & amount selection finished.
|
||||
Get price, confirmation message & handle balances.
|
||||
"""
|
||||
currency = Currency(ctx.author.id)
|
||||
worth = item.get_item_worth()
|
||||
total = worth * amount_to_sell
|
||||
view = interaction.ExchangeConfirmation(ctx)
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.embed_background(),
|
||||
description=f"You're about to sell **{amount_to_sell} {item.display_name}(s)** for **${total}**. "
|
||||
f"Are you absolutely sure about this?"
|
||||
)
|
||||
message = await ctx.respond(embed=embed, view=view, content=ctx.author.mention)
|
||||
await view.wait()
|
||||
|
||||
if view.clickedConfirm:
|
||||
|
||||
try:
|
||||
currency.balance += total
|
||||
currency.push()
|
||||
inv.take_item(item, amount_to_sell)
|
||||
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.green(),
|
||||
description=f"You have successfully sold "
|
||||
f"**{amount_to_sell} {item.display_name}(s)** for **${total}**."
|
||||
)
|
||||
await message.edit(embed=embed, view=None)
|
||||
|
||||
except Exception as e:
|
||||
await ctx.respond("Something went wrong.")
|
||||
logs.error(f"[CommandHandler] /sell post-confirmation error: {e}")
|
||||
return
|
||||
|
||||
else:
|
||||
return await message.edit(embed=None, content=f"**{ctx.author.name}** canceled the command.")
|
||||
|
||||
else:
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.red(),
|
||||
description="You selected not to sell anything."
|
||||
)
|
||||
await ctx.edit(embed=embed)
|
||||
return await sell.cmd(self, ctx)
|
||||
|
||||
@bridge.bridge_command(
|
||||
name="slots",
|
||||
|
@ -460,83 +109,14 @@ class Economy(commands.Cog):
|
|||
)
|
||||
@commands.check(checks.channel)
|
||||
async def slots_command(self, ctx, *, bet: int):
|
||||
|
||||
# Currency handler
|
||||
ctx_currency = Currency(ctx.author.id)
|
||||
|
||||
# check if the user has enough cash
|
||||
player_balance = ctx_currency.balance
|
||||
if bet > player_balance:
|
||||
return await ctx.respond(embed=err_embeds.InsufficientBalance(ctx))
|
||||
elif bet <= 0:
|
||||
return await ctx.respond(embed=err_embeds.BadBetArgument(ctx))
|
||||
|
||||
# # check if the bet exceeds the bet limit
|
||||
# bet_limit = int(economy_config["bet_limit"])
|
||||
# if abs(bet) > bet_limit:
|
||||
# message = strings["bet_limit"].format(ctx.author.name, Currency.format_human(bet_limit))
|
||||
# return await ctx.respond(content=message)
|
||||
|
||||
# calculate the results before the command is shown
|
||||
results = [random.randint(0, 6) for _ in range(3)]
|
||||
calculated_results = slots.calculate_slots_results(bet, results)
|
||||
|
||||
(type, payout, multiplier) = calculated_results
|
||||
is_won = True
|
||||
|
||||
if type == "lost":
|
||||
is_won = False
|
||||
|
||||
# only get the emojis once
|
||||
emojis = slots.get_emotes(self.client)
|
||||
|
||||
# start with default "spinning" embed
|
||||
await ctx.respond(embed=slots.slots_spinning(ctx, 3, Currency.format_human(bet), results, emojis))
|
||||
await asyncio.sleep(1)
|
||||
|
||||
for i in range(2, 0, -1):
|
||||
await ctx.edit(embed=slots.slots_spinning(ctx, i, Currency.format_human(bet), results, emojis))
|
||||
await asyncio.sleep(1)
|
||||
|
||||
# output final result
|
||||
finished_output = slots.slots_finished(ctx, type, Currency.format_human(bet),
|
||||
Currency.format_human(payout), results, emojis)
|
||||
|
||||
item_reward = ItemHandler(ctx)
|
||||
field = await item_reward.rave_coin(is_won=is_won, bet=bet, field="")
|
||||
|
||||
if field is not "":
|
||||
finished_output.add_field(name="Extra Rewards", value=field, inline=False)
|
||||
|
||||
await ctx.edit(embed=finished_output)
|
||||
|
||||
# user payout
|
||||
if payout > 0:
|
||||
ctx_currency.add_balance(payout)
|
||||
else:
|
||||
ctx_currency.take_balance(bet)
|
||||
|
||||
# item_reward = ItemHandler(ctx)
|
||||
# await item_reward.rave_coin(is_won=is_won, bet=bet)
|
||||
|
||||
stats = SlotsStats(
|
||||
user_id=ctx.author.id,
|
||||
is_won=is_won,
|
||||
bet=bet,
|
||||
payout=payout,
|
||||
spin_type=type,
|
||||
icons=results
|
||||
)
|
||||
|
||||
ctx_currency.push()
|
||||
stats.push()
|
||||
return await slots.cmd(self, ctx, bet)
|
||||
|
||||
@slots_command.error
|
||||
async def on_command_error(self, ctx, error):
|
||||
if isinstance(error, commands.MissingRequiredArgument):
|
||||
await ctx.respond(embed=err_embeds.MissingBet(ctx))
|
||||
await ctx.respond(embed=EconErrors.missing_bet(ctx))
|
||||
elif isinstance(error, commands.BadArgument):
|
||||
await ctx.respond(embed=err_embeds.BadBetArgument(ctx))
|
||||
await ctx.respond(embed=EconErrors.bad_bet_argument(ctx))
|
||||
else:
|
||||
raise error
|
||||
|
||||
|
@ -547,45 +127,7 @@ class Economy(commands.Cog):
|
|||
)
|
||||
@commands.check(checks.channel)
|
||||
async def stats(self, ctx, *, game: discord.Option(choices=["BlackJack", "Slots"])):
|
||||
output = ""
|
||||
|
||||
if game == "BlackJack":
|
||||
stats = BlackJackStats.get_user_stats(ctx.author.id)
|
||||
|
||||
# amount formatting
|
||||
total_bet = Currency.format_human(stats["total_bet"])
|
||||
total_payout = Currency.format_human(stats["total_payout"])
|
||||
|
||||
# output = f"{ctx.author.name}'s racu stats\n\n"
|
||||
output = strings["stats_blackjack"].format(
|
||||
stats["amount_of_games"],
|
||||
total_bet,
|
||||
stats["winning_amount"],
|
||||
total_payout
|
||||
)
|
||||
|
||||
elif game == "Slots":
|
||||
stats = SlotsStats.get_user_stats(ctx.author.id)
|
||||
|
||||
# amount formatting
|
||||
total_bet = Currency.format_human(stats["total_bet"])
|
||||
total_payout = Currency.format_human(stats["total_payout"])
|
||||
|
||||
output = strings["stats_slots"].format(stats["amount_of_games"], total_bet, total_payout)
|
||||
output += "\n\n"
|
||||
|
||||
pair_emote = self.client.get_emoji(economy_config["slots"]["emotes"]["slots_0_id"])
|
||||
three_emote = self.client.get_emoji(economy_config["slots"]["emotes"]["slots_4_id"])
|
||||
diamonds_emote = self.client.get_emoji(economy_config["slots"]["emotes"]["slots_5_id"])
|
||||
seven_emote = self.client.get_emoji(economy_config["slots"]["emotes"]["slots_6_id"])
|
||||
|
||||
output += f"{pair_emote} | **{stats['games_won_pair']}** pairs.\n"
|
||||
output += f"{three_emote} | **{stats['games_won_three_of_a_kind']}** three-of-a-kinds.\n"
|
||||
output += f"{diamonds_emote} | **{stats['games_won_three_diamonds']}** triple diamonds.\n"
|
||||
output += f"{seven_emote} | **{stats['games_won_jackpot']}** jackpots."
|
||||
|
||||
output += "\n\n *This command is still in beta, stats may be slightly inaccurate.*"
|
||||
await ctx.respond(content=output)
|
||||
return await stats.cmd(self, ctx, game)
|
||||
|
||||
|
||||
def setup(client):
|
||||
|
|
|
@ -5,9 +5,188 @@ import discord
|
|||
import pytz
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from handlers.ItemHandler import ItemHandler
|
||||
from lib import economy_embeds, economy_functions, interaction, embeds_old
|
||||
from lib.embeds.error import EconErrors
|
||||
from main import economy_config
|
||||
from services.BlackJackStats import BlackJackStats
|
||||
from services.Currency import Currency
|
||||
|
||||
logs = logging.getLogger('Racu.Core')
|
||||
load_dotenv('.env')
|
||||
est = pytz.timezone('US/Eastern')
|
||||
active_blackjack_games = {}
|
||||
|
||||
|
||||
async def cmd(ctx, bet: int):
|
||||
"""
|
||||
status states:
|
||||
0 = game start
|
||||
1 = player busted
|
||||
2 = player won with 21 (after hit)
|
||||
3 = dealer busted
|
||||
4 = dealer won
|
||||
5 = player won with 21 (blackjack)
|
||||
6 = timed out
|
||||
"""
|
||||
|
||||
# check if the player already has an active blackjack going
|
||||
if ctx.author.id in active_blackjack_games:
|
||||
await ctx.respond(embed=economy_embeds.already_playing("BlackJack"))
|
||||
return
|
||||
|
||||
# Currency handler
|
||||
ctx_currency = Currency(ctx.author.id)
|
||||
|
||||
# check if the user has enough cash
|
||||
player_balance = ctx_currency.balance
|
||||
if bet > player_balance:
|
||||
return await ctx.respond(embed=EconErrors.insufficient_balance(ctx))
|
||||
elif bet <= 0:
|
||||
return await ctx.respond(embed=EconErrors.bad_bet_argument(ctx))
|
||||
|
||||
# check if the bet exceeds the bet limit
|
||||
# bet_limit = int(economy_config["bet_limit"])
|
||||
# if abs(bet) > bet_limit:
|
||||
# message = strings["bet_limit"].format(ctx.author.name, Currency.format_human(bet_limit))
|
||||
# return await ctx.respond(content=message)
|
||||
|
||||
active_blackjack_games[ctx.author.id] = True
|
||||
|
||||
try:
|
||||
|
||||
player_hand = []
|
||||
dealer_hand = []
|
||||
deck = economy_functions.blackjack_get_new_deck()
|
||||
multiplier = float(economy_config["blackjack"]["reward_multiplier"])
|
||||
|
||||
# deal initial cards (player draws two & dealer one)
|
||||
player_hand.append(economy_functions.blackjack_deal_card(deck))
|
||||
player_hand.append(economy_functions.blackjack_deal_card(deck))
|
||||
dealer_hand.append(economy_functions.blackjack_deal_card(deck))
|
||||
|
||||
# calculate initial hands
|
||||
player_hand_value = economy_functions.blackjack_calculate_hand_value(player_hand)
|
||||
dealer_hand_value = economy_functions.blackjack_calculate_hand_value(dealer_hand)
|
||||
|
||||
status = 0 if player_hand_value != 21 else 5
|
||||
view = interaction.BlackJackButtons(ctx)
|
||||
playing_embed = False
|
||||
|
||||
while status == 0:
|
||||
if not playing_embed:
|
||||
await ctx.respond(embed=blackjack_show(ctx, Currency.format_human(bet), player_hand,
|
||||
dealer_hand, player_hand_value,
|
||||
dealer_hand_value),
|
||||
view=view,
|
||||
content=ctx.author.mention)
|
||||
|
||||
playing_embed = True
|
||||
|
||||
await view.wait()
|
||||
|
||||
if view.clickedHit:
|
||||
# player draws a card & value is calculated
|
||||
player_hand.append(economy_functions.blackjack_deal_card(deck))
|
||||
player_hand_value = economy_functions.blackjack_calculate_hand_value(player_hand)
|
||||
|
||||
if player_hand_value > 21:
|
||||
status = 1
|
||||
break
|
||||
elif player_hand_value == 21:
|
||||
status = 2
|
||||
break
|
||||
|
||||
elif view.clickedStand:
|
||||
# player stands, dealer draws cards until he wins OR busts
|
||||
while dealer_hand_value <= player_hand_value:
|
||||
dealer_hand.append(economy_functions.blackjack_deal_card(deck))
|
||||
dealer_hand_value = economy_functions.blackjack_calculate_hand_value(dealer_hand)
|
||||
|
||||
if dealer_hand_value > 21:
|
||||
status = 3
|
||||
break
|
||||
else:
|
||||
status = 4
|
||||
break
|
||||
|
||||
else:
|
||||
status = 6
|
||||
break
|
||||
|
||||
# refresh
|
||||
view = interaction.BlackJackButtons(ctx)
|
||||
embed = blackjack_show(ctx, Currency.format_human(bet), player_hand,
|
||||
dealer_hand, player_hand_value,
|
||||
dealer_hand_value)
|
||||
|
||||
await ctx.edit(embed=embed, view=view, content=ctx.author.mention)
|
||||
|
||||
"""
|
||||
At this point the game has concluded, generate a final output & backend
|
||||
"""
|
||||
payout = bet * multiplier if not status == 5 else bet * 2
|
||||
is_won = False if status == 1 or status == 4 else True
|
||||
|
||||
embed = blackjack_finished(ctx, Currency.format_human(bet), player_hand_value,
|
||||
dealer_hand_value, Currency.format_human(payout), status)
|
||||
|
||||
item_reward = ItemHandler(ctx)
|
||||
field = await item_reward.rave_coin(is_won=is_won, bet=bet, field="")
|
||||
field = await item_reward.bitch_coin(status, field)
|
||||
|
||||
if field is not "":
|
||||
embed.add_field(name="Extra Rewards", value=field, inline=False)
|
||||
|
||||
if playing_embed:
|
||||
await ctx.edit(embed=embed, view=None, content=ctx.author.mention)
|
||||
else:
|
||||
await ctx.respond(embed=embed, view=None, content=ctx.author.mention)
|
||||
|
||||
# change balance
|
||||
# if status == 1 or status == 4:
|
||||
if not is_won:
|
||||
ctx_currency.take_balance(bet)
|
||||
ctx_currency.push()
|
||||
|
||||
# push stats (low priority)
|
||||
stats = BlackJackStats(
|
||||
user_id=ctx.author.id,
|
||||
is_won=False,
|
||||
bet=bet,
|
||||
payout=0,
|
||||
hand_player=player_hand,
|
||||
hand_dealer=dealer_hand
|
||||
)
|
||||
stats.push()
|
||||
|
||||
elif status == 6:
|
||||
await ctx.send(embed=economy_embeds.out_of_time(), content=ctx.author.mention)
|
||||
ctx_currency.take_balance(bet)
|
||||
ctx_currency.push()
|
||||
|
||||
else:
|
||||
ctx_currency.add_balance(payout)
|
||||
ctx_currency.push()
|
||||
|
||||
# push stats (low priority)
|
||||
stats = BlackJackStats(
|
||||
user_id=ctx.author.id,
|
||||
is_won=True,
|
||||
bet=bet,
|
||||
payout=payout,
|
||||
hand_player=player_hand,
|
||||
hand_dealer=dealer_hand
|
||||
)
|
||||
stats.push()
|
||||
|
||||
except Exception as e:
|
||||
await ctx.respond(embed=embeds_old.command_error_1(e))
|
||||
logs.error("[CommandHandler] Something went wrong in the gambling command: ", e)
|
||||
|
||||
finally:
|
||||
# remove player from active games list
|
||||
del active_blackjack_games[ctx.author.id]
|
||||
|
||||
|
||||
def blackjack_show(ctx, bet, player_hand, dealer_hand, player_hand_value, dealer_hand_value):
|
||||
|
|
27
modules/economy/daily.py
Normal file
27
modules/economy/daily.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
from datetime import datetime, timedelta
|
||||
|
||||
import lib.time
|
||||
from lib.embeds.info import EconInfo
|
||||
from lib.embeds.error import EconErrors
|
||||
from services.Currency import Currency
|
||||
from services.Dailies import Dailies
|
||||
|
||||
|
||||
async def cmd(ctx):
|
||||
ctx_daily = Dailies(ctx.author.id)
|
||||
|
||||
if not ctx_daily.can_be_claimed():
|
||||
wait_time = datetime.now() + timedelta(seconds=lib.time.seconds_until(7, 0))
|
||||
unix_time = int(round(wait_time.timestamp()))
|
||||
embed = EconErrors.daily_already_claimed(ctx, unix_time)
|
||||
return await ctx.respond(embed=embed)
|
||||
|
||||
ctx_daily.streak = ctx_daily.streak + 1 if ctx_daily.streak_check() else 1
|
||||
ctx_daily.claimed_at = datetime.now(tz=ctx_daily.tz).isoformat()
|
||||
ctx_daily.amount = int(100 * (12 * (ctx_daily.streak - 1)))
|
||||
|
||||
ctx_daily.refresh()
|
||||
|
||||
embed = EconInfo.daily_reward_claimed(ctx, Currency.format(ctx_daily.amount), ctx_daily.streak)
|
||||
|
||||
await ctx.respond(embed=embed)
|
48
modules/economy/give.py
Normal file
48
modules/economy/give.py
Normal file
|
@ -0,0 +1,48 @@
|
|||
import discord
|
||||
|
||||
from lib import economy_embeds
|
||||
from services.Currency import Currency
|
||||
|
||||
|
||||
async def cmd(ctx, user, amount):
|
||||
if ctx.author.id == user.id:
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.red(),
|
||||
description=f"You can't give money to yourself, silly."
|
||||
)
|
||||
return await ctx.respond(embed=embed)
|
||||
elif user.bot:
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.red(),
|
||||
description=f"You can't give money to a bot, silly."
|
||||
)
|
||||
return await ctx.respond(embed=embed)
|
||||
|
||||
# Currency handler
|
||||
ctx_currency = Currency(ctx.author.id)
|
||||
target_currency = Currency(user.id)
|
||||
|
||||
try:
|
||||
author_balance = ctx_currency.balance
|
||||
|
||||
if author_balance < amount or author_balance <= 0:
|
||||
return await ctx.respond(embed=economy_embeds.not_enough_cash())
|
||||
|
||||
target_currency.add_balance(amount)
|
||||
ctx_currency.take_balance(amount)
|
||||
|
||||
ctx_currency.push()
|
||||
target_currency.push()
|
||||
|
||||
except Exception as e:
|
||||
await ctx.respond("Something funky happened.. Sorry about that.", ephemeral=True)
|
||||
print(e)
|
||||
return
|
||||
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.green(),
|
||||
description=f"**{ctx.author.name}** gave **${Currency.format(amount)}** to {user.name}."
|
||||
)
|
||||
embed.set_footer(text="Say thanks! :)")
|
||||
|
||||
await ctx.respond(embed=embed)
|
33
modules/economy/inventory.py
Normal file
33
modules/economy/inventory.py
Normal file
|
@ -0,0 +1,33 @@
|
|||
import discord
|
||||
|
||||
from services.Inventory import Inventory
|
||||
|
||||
|
||||
async def cmd(ctx):
|
||||
inventory = Inventory(ctx.author.id)
|
||||
inventory_dict = inventory.get_inventory()
|
||||
|
||||
description = "You don't have any items!" if inventory_dict == {} else None
|
||||
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.embed_background(),
|
||||
description=description
|
||||
)
|
||||
embed.set_author(name=ctx.author.name, icon_url=ctx.author.avatar.url)
|
||||
|
||||
for item, quantity in inventory_dict.items():
|
||||
if item.type == "badge":
|
||||
|
||||
if not embed.description:
|
||||
embed.description = "**Badges:** "
|
||||
|
||||
emote = self.client.get_emoji(item.emote_id)
|
||||
embed.description += f"{emote} "
|
||||
|
||||
else:
|
||||
emote = self.client.get_emoji(item.emote_id)
|
||||
embed.add_field(name=f"{emote} {item.display_name.capitalize()}",
|
||||
value=f"*— amount: `{quantity}`*",
|
||||
inline=False)
|
||||
|
||||
await ctx.respond(embed=embed)
|
|
@ -11,10 +11,6 @@ logs = logging.getLogger('Racu.Core')
|
|||
|
||||
|
||||
async def cmd(ctx):
|
||||
"""
|
||||
Leaderboard command with a dropdown menu.
|
||||
:param ctx:
|
||||
"""
|
||||
xp_lb = Xp.load_leaderboard(ctx.guild.id)
|
||||
|
||||
options = LeaderboardCommandOptions()
|
||||
|
|
|
@ -1,13 +1,139 @@
|
|||
import asyncio
|
||||
import logging
|
||||
|
||||
import discord
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from lib import interaction
|
||||
from services.Currency import Currency
|
||||
from services.Inventory import Inventory
|
||||
from services.Item import Item
|
||||
|
||||
logs = logging.getLogger('Racu.Core')
|
||||
|
||||
load_dotenv('.env')
|
||||
|
||||
|
||||
async def cmd(self, ctx):
|
||||
inv = Inventory(ctx.author.id)
|
||||
items = inv.get_sell_data()
|
||||
|
||||
def response_check(msg):
|
||||
return msg.author == ctx.author and msg.channel == ctx.channel
|
||||
|
||||
if not items:
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.red(),
|
||||
description="You don't have any items to sell."
|
||||
)
|
||||
return await ctx.respond(embed=embed)
|
||||
|
||||
options = SellCommandOptions(items)
|
||||
view = SellCommandView(ctx, options)
|
||||
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.embed_background(),
|
||||
description="Please select the item you want to sell."
|
||||
)
|
||||
await ctx.respond(embed=embed, view=view, content=ctx.author.mention)
|
||||
|
||||
await view.wait()
|
||||
item = view.item
|
||||
|
||||
if item:
|
||||
item = Item.get_item_by_display_name(view.item)
|
||||
quantity = item.get_quantity(ctx.author.id)
|
||||
|
||||
if quantity == 1:
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.embed_background(),
|
||||
description=f"You selected **{item.display_name}**, you have this item only once."
|
||||
)
|
||||
await ctx.edit(embed=embed)
|
||||
amount_to_sell = 1
|
||||
|
||||
elif quantity > 1:
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.embed_background(),
|
||||
description=f"You selected **{item.display_name}**, you have this item **{quantity}** times.\n"
|
||||
)
|
||||
embed.set_footer(text=f"Please type the amount you want to sell in this chat.")
|
||||
await ctx.edit(embed=embed)
|
||||
|
||||
try:
|
||||
amount_message = await self.client.wait_for('message', check=response_check, timeout=60)
|
||||
amount = amount_message.content
|
||||
|
||||
if is_number_between(amount, quantity):
|
||||
amount_to_sell = int(amount)
|
||||
|
||||
else:
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.red(),
|
||||
description="Invalid input... try the command again."
|
||||
)
|
||||
return await ctx.respond(embed=embed, content=ctx.author.mention)
|
||||
|
||||
except asyncio.TimeoutError:
|
||||
await ctx.respond(
|
||||
embed=discord.Embed(description="You ran out of time.", color=discord.Color.red()),
|
||||
content=ctx.author.mention)
|
||||
# logs.warning(f"{ctx.author.id} Sell Timeout")
|
||||
return
|
||||
|
||||
else:
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.red(),
|
||||
description="You dont have this item."
|
||||
)
|
||||
embed.set_footer(text="It shouldn't have showed up in the list, my apologies.")
|
||||
return await ctx.edit(embed=embed)
|
||||
|
||||
"""
|
||||
Item & amount selection finished.
|
||||
Get price, confirmation message & handle balances.
|
||||
"""
|
||||
currency = Currency(ctx.author.id)
|
||||
worth = item.get_item_worth()
|
||||
total = worth * amount_to_sell
|
||||
view = interaction.ExchangeConfirmation(ctx)
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.embed_background(),
|
||||
description=f"You're about to sell **{amount_to_sell} {item.display_name}(s)** for **${total}**. "
|
||||
f"Are you absolutely sure about this?"
|
||||
)
|
||||
message = await ctx.respond(embed=embed, view=view, content=ctx.author.mention)
|
||||
await view.wait()
|
||||
|
||||
if view.clickedConfirm:
|
||||
|
||||
try:
|
||||
currency.balance += total
|
||||
currency.push()
|
||||
inv.take_item(item, amount_to_sell)
|
||||
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.green(),
|
||||
description=f"You have successfully sold "
|
||||
f"**{amount_to_sell} {item.display_name}(s)** for **${total}**."
|
||||
)
|
||||
await message.edit(embed=embed, view=None)
|
||||
|
||||
except Exception as e:
|
||||
await ctx.respond("Something went wrong.")
|
||||
logs.error(f"[CommandHandler] /sell post-confirmation error: {e}")
|
||||
return
|
||||
|
||||
else:
|
||||
return await message.edit(embed=None, content=f"**{ctx.author.name}** canceled the command.")
|
||||
|
||||
else:
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.red(),
|
||||
description="You selected not to sell anything."
|
||||
)
|
||||
await ctx.edit(embed=embed)
|
||||
|
||||
class SellCommandOptions(discord.ui.Select):
|
||||
def __init__(self, items: str):
|
||||
self.item = None
|
||||
|
|
|
@ -1,14 +1,92 @@
|
|||
import asyncio
|
||||
import datetime
|
||||
import random
|
||||
from collections import Counter
|
||||
|
||||
import discord
|
||||
import pytz
|
||||
|
||||
from handlers.ItemHandler import ItemHandler
|
||||
from lib.embeds.error import EconErrors
|
||||
from main import economy_config
|
||||
from services.Currency import Currency
|
||||
from services.SlotsStats import SlotsStats
|
||||
|
||||
est = pytz.timezone('US/Eastern')
|
||||
|
||||
|
||||
async def cmd(self, ctx, bet):
|
||||
# Currency handler
|
||||
ctx_currency = Currency(ctx.author.id)
|
||||
|
||||
# check if the user has enough cash
|
||||
player_balance = ctx_currency.balance
|
||||
if bet > player_balance:
|
||||
return await ctx.respond(embed=EconErrors.insufficient_balance(ctx))
|
||||
elif bet <= 0:
|
||||
return await ctx.respond(embed=EconErrors.bad_bet_argument(ctx))
|
||||
|
||||
# # check if the bet exceeds the bet limit
|
||||
# bet_limit = int(economy_config["bet_limit"])
|
||||
# if abs(bet) > bet_limit:
|
||||
# message = strings["bet_limit"].format(ctx.author.name, Currency.format_human(bet_limit))
|
||||
# return await ctx.respond(content=message)
|
||||
|
||||
# calculate the results before the command is shown
|
||||
results = [random.randint(0, 6) for _ in range(3)]
|
||||
calculated_results = calculate_slots_results(bet, results)
|
||||
|
||||
(type, payout, multiplier) = calculated_results
|
||||
is_won = True
|
||||
|
||||
if type == "lost":
|
||||
is_won = False
|
||||
|
||||
# only get the emojis once
|
||||
emojis = get_emotes(self.client)
|
||||
|
||||
# start with default "spinning" embed
|
||||
await ctx.respond(embed=slots_spinning(ctx, 3, Currency.format_human(bet), results, emojis))
|
||||
await asyncio.sleep(1)
|
||||
|
||||
for i in range(2, 0, -1):
|
||||
await ctx.edit(embed=slots_spinning(ctx, i, Currency.format_human(bet), results, emojis))
|
||||
await asyncio.sleep(1)
|
||||
|
||||
# output final result
|
||||
finished_output = slots_finished(ctx, type, Currency.format_human(bet),
|
||||
Currency.format_human(payout), results, emojis)
|
||||
|
||||
item_reward = ItemHandler(ctx)
|
||||
field = await item_reward.rave_coin(is_won=is_won, bet=bet, field="")
|
||||
|
||||
if field is not "":
|
||||
finished_output.add_field(name="Extra Rewards", value=field, inline=False)
|
||||
|
||||
await ctx.edit(embed=finished_output)
|
||||
|
||||
# user payout
|
||||
if payout > 0:
|
||||
ctx_currency.add_balance(payout)
|
||||
else:
|
||||
ctx_currency.take_balance(bet)
|
||||
|
||||
# item_reward = ItemHandler(ctx)
|
||||
# await item_reward.rave_coin(is_won=is_won, bet=bet)
|
||||
|
||||
stats = SlotsStats(
|
||||
user_id=ctx.author.id,
|
||||
is_won=is_won,
|
||||
bet=bet,
|
||||
payout=payout,
|
||||
spin_type=type,
|
||||
icons=results
|
||||
)
|
||||
|
||||
ctx_currency.push()
|
||||
stats.push()
|
||||
|
||||
|
||||
def get_emotes(client):
|
||||
decoration = economy_config["slots"]["emotes"]
|
||||
emojis = {name: client.get_emoji(emoji_id) for name, emoji_id in decoration.items()}
|
||||
|
|
46
modules/economy/stats.py
Normal file
46
modules/economy/stats.py
Normal file
|
@ -0,0 +1,46 @@
|
|||
from main import strings, economy_config
|
||||
from services.BlackJackStats import BlackJackStats
|
||||
from services.Currency import Currency
|
||||
from services.SlotsStats import SlotsStats
|
||||
|
||||
|
||||
async def cmd(self, ctx, game):
|
||||
output = ""
|
||||
|
||||
if game == "BlackJack":
|
||||
stats = BlackJackStats.get_user_stats(ctx.author.id)
|
||||
|
||||
# amount formatting
|
||||
total_bet = Currency.format_human(stats["total_bet"])
|
||||
total_payout = Currency.format_human(stats["total_payout"])
|
||||
|
||||
# output = f"{ctx.author.name}'s racu stats\n\n"
|
||||
output = strings["stats_blackjack"].format(
|
||||
stats["amount_of_games"],
|
||||
total_bet,
|
||||
stats["winning_amount"],
|
||||
total_payout
|
||||
)
|
||||
|
||||
elif game == "Slots":
|
||||
stats = SlotsStats.get_user_stats(ctx.author.id)
|
||||
|
||||
# amount formatting
|
||||
total_bet = Currency.format_human(stats["total_bet"])
|
||||
total_payout = Currency.format_human(stats["total_payout"])
|
||||
|
||||
output = strings["stats_slots"].format(stats["amount_of_games"], total_bet, total_payout)
|
||||
output += "\n\n"
|
||||
|
||||
pair_emote = self.client.get_emoji(economy_config["slots"]["emotes"]["slots_0_id"])
|
||||
three_emote = self.client.get_emoji(economy_config["slots"]["emotes"]["slots_4_id"])
|
||||
diamonds_emote = self.client.get_emoji(economy_config["slots"]["emotes"]["slots_5_id"])
|
||||
seven_emote = self.client.get_emoji(economy_config["slots"]["emotes"]["slots_6_id"])
|
||||
|
||||
output += f"{pair_emote} | **{stats['games_won_pair']}** pairs.\n"
|
||||
output += f"{three_emote} | **{stats['games_won_three_of_a_kind']}** three-of-a-kinds.\n"
|
||||
output += f"{diamonds_emote} | **{stats['games_won_three_diamonds']}** triple diamonds.\n"
|
||||
output += f"{seven_emote} | **{stats['games_won_jackpot']}** jackpots."
|
||||
|
||||
output += "\n\n *This command is still in beta, stats may be slightly inaccurate.*"
|
||||
await ctx.respond(content=output)
|
|
@ -4,7 +4,7 @@ import discord
|
|||
from discord.ext import commands
|
||||
from discord.commands import SlashCommandGroup
|
||||
from services.GuildConfig import GuildConfig
|
||||
from lib import formatter, embeds
|
||||
from lib import formatter, embeds_old
|
||||
|
||||
from main import strings
|
||||
|
||||
|
@ -203,7 +203,7 @@ class Config(commands.Cog):
|
|||
embed.set_author(name="Server Configuration", icon_url=guild_icon)
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
embed = embeds.welcome_message(ctx.author, text)
|
||||
embed = embeds_old.welcome_message(ctx.author, text)
|
||||
return await ctx.send(embed=embed, content=ctx.author.mention)
|
||||
|
||||
@level_config.command(
|
||||
|
|
|
@ -6,7 +6,7 @@ import subprocess
|
|||
import discord
|
||||
from discord.ext import commands
|
||||
|
||||
from lib import interaction, embeds, checks
|
||||
from lib import interaction, embeds_old, checks
|
||||
|
||||
logs = logging.getLogger('Racu.Core')
|
||||
|
||||
|
@ -84,7 +84,7 @@ class BasicCog(commands.Cog):
|
|||
logs.debug(f"{ctx.author.name} clicked Short Intro")
|
||||
|
||||
# START NICKNAME
|
||||
await ctx.send(embed=embeds.simple_question_first("How would you like to be identified in the server?"))
|
||||
await ctx.send(embed=embeds_old.simple_question_first("How would you like to be identified in the server?"))
|
||||
|
||||
try:
|
||||
nickname_message = await self.client.wait_for('message', check=check, timeout=120)
|
||||
|
@ -95,7 +95,7 @@ class BasicCog(commands.Cog):
|
|||
logs.debug(f"{ctx.author.name} nickname: {nickname}")
|
||||
|
||||
# START AGE
|
||||
await ctx.send(embed=embeds.simple_question_5("How old are you?"),
|
||||
await ctx.send(embed=embeds_old.simple_question_5("How old are you?"),
|
||||
content=f"Recorded answer: {nickname}")
|
||||
|
||||
try:
|
||||
|
@ -108,7 +108,7 @@ class BasicCog(commands.Cog):
|
|||
|
||||
# START LOCATION
|
||||
view = interaction.LocationOptions(ctx)
|
||||
await ctx.send(embed=embeds.simple_question_none("Where do you live?"),
|
||||
await ctx.send(embed=embeds_old.simple_question_none("Where do you live?"),
|
||||
view=view,
|
||||
content=f"Recorded answer: {age}")
|
||||
|
||||
|
@ -116,14 +116,14 @@ class BasicCog(commands.Cog):
|
|||
location = view.location
|
||||
|
||||
if not view.location:
|
||||
await ctx.send(embed=embeds.no_time())
|
||||
await ctx.send(embed=embeds_old.no_time())
|
||||
return
|
||||
|
||||
logs.debug(f"{ctx.author.name} location: {location}")
|
||||
|
||||
# START PRONOUNS
|
||||
await ctx.send(
|
||||
embed=embeds.simple_question_30("What are your preferred pronouns?"),
|
||||
embed=embeds_old.simple_question_30("What are your preferred pronouns?"),
|
||||
content=f"Recorded answer: {location}")
|
||||
|
||||
try:
|
||||
|
@ -135,7 +135,7 @@ class BasicCog(commands.Cog):
|
|||
logs.debug(f"{ctx.author.name} pronouns: {pronouns}")
|
||||
|
||||
# START LIKES
|
||||
await ctx.send(embed=embeds.simple_question_300("Likes & interests"),
|
||||
await ctx.send(embed=embeds_old.simple_question_300("Likes & interests"),
|
||||
content=f"Recorded answer: {pronouns}")
|
||||
|
||||
try:
|
||||
|
@ -147,7 +147,7 @@ class BasicCog(commands.Cog):
|
|||
logs.debug(f"{ctx.author.name} likes: {likes}")
|
||||
|
||||
# START DISLIKES
|
||||
await ctx.send(embed=embeds.simple_question_300("Dislikes"),
|
||||
await ctx.send(embed=embeds_old.simple_question_300("Dislikes"),
|
||||
content=f"Recorded answer: {likes}")
|
||||
|
||||
try:
|
||||
|
@ -159,7 +159,7 @@ class BasicCog(commands.Cog):
|
|||
logs.debug(f"{ctx.author.name} dislikes: {dislikes}")
|
||||
|
||||
# POST EXAMPLE EMBED AND FINAL IF APPROVED
|
||||
em = embeds.final_embed_short(ctx, nickname, age, location, pronouns, likes, dislikes)
|
||||
em = embeds_old.final_embed_short(ctx, nickname, age, location, pronouns, likes, dislikes)
|
||||
|
||||
view = interaction.Confirm(ctx)
|
||||
await ctx.send(embed=em, content=f"Introduction of <@{ctx.author.id}>", view=view)
|
||||
|
@ -168,36 +168,36 @@ class BasicCog(commands.Cog):
|
|||
if view.clickedConfirm:
|
||||
intro_channel = guild.get_channel(channel_id)
|
||||
await intro_channel.send(embed=em, content=f"Introduction of <@{ctx.author.id}>")
|
||||
await ctx.send(embed=embeds.final_confirmation(channel_id))
|
||||
await ctx.send(embed=embeds_old.final_confirmation(channel_id))
|
||||
logs.info(f"[CommandHandler] {ctx.author.name} introduction was submitted.")
|
||||
return
|
||||
else:
|
||||
await ctx.send(embed=embeds.no_time())
|
||||
await ctx.send(embed=embeds_old.no_time())
|
||||
logs.warning(f"{ctx.author.id} Intro Timeout")
|
||||
return
|
||||
|
||||
except asyncio.TimeoutError:
|
||||
await ctx.send(embed=embeds.no_time())
|
||||
await ctx.send(embed=embeds_old.no_time())
|
||||
logs.warning(f"{ctx.author.id} Intro Timeout")
|
||||
return
|
||||
|
||||
except asyncio.TimeoutError:
|
||||
await ctx.send(embed=embeds.no_time())
|
||||
await ctx.send(embed=embeds_old.no_time())
|
||||
logs.warning(f"{ctx.author.id} Intro Timeout")
|
||||
return
|
||||
|
||||
except asyncio.TimeoutError:
|
||||
await ctx.send(embed=embeds.no_time())
|
||||
await ctx.send(embed=embeds_old.no_time())
|
||||
logs.warning(f"{ctx.author.id} Intro Timeout")
|
||||
return
|
||||
|
||||
except asyncio.TimeoutError:
|
||||
await ctx.send(embed=embeds.no_time())
|
||||
await ctx.send(embed=embeds_old.no_time())
|
||||
logs.warning(f"{ctx.author.id} Intro Timeout")
|
||||
return
|
||||
|
||||
except asyncio.TimeoutError:
|
||||
await ctx.send(embed=embeds.no_time())
|
||||
await ctx.send(embed=embeds_old.no_time())
|
||||
logs.warning(f"{ctx.author.id} Intro Timeout")
|
||||
return
|
||||
|
||||
|
@ -205,7 +205,7 @@ class BasicCog(commands.Cog):
|
|||
logs.debug(f"{ctx.author.name} clicked Long Intro")
|
||||
|
||||
# START NICKNAME
|
||||
await ctx.send(embed=embeds.simple_question_first_extended(
|
||||
await ctx.send(embed=embeds_old.simple_question_first_extended(
|
||||
"How would you like to be identified in the server?"))
|
||||
|
||||
try:
|
||||
|
@ -217,7 +217,7 @@ class BasicCog(commands.Cog):
|
|||
logs.debug(f"{ctx.author.name} nickname: {nickname}")
|
||||
|
||||
# START AGE
|
||||
await ctx.send(embed=embeds.simple_question_5("How old are you?"),
|
||||
await ctx.send(embed=embeds_old.simple_question_5("How old are you?"),
|
||||
content=f"Recorded answer: {nickname}")
|
||||
|
||||
try:
|
||||
|
@ -230,7 +230,7 @@ class BasicCog(commands.Cog):
|
|||
|
||||
# START LOCATION
|
||||
view = interaction.LocationOptions(ctx)
|
||||
await ctx.send(embed=embeds.simple_question_none("Where do you live?"),
|
||||
await ctx.send(embed=embeds_old.simple_question_none("Where do you live?"),
|
||||
view=view,
|
||||
content=f"Recorded answer: {age}")
|
||||
|
||||
|
@ -238,14 +238,14 @@ class BasicCog(commands.Cog):
|
|||
location = view.location
|
||||
|
||||
if not view.location:
|
||||
await ctx.send(embed=embeds.no_time())
|
||||
await ctx.send(embed=embeds_old.no_time())
|
||||
return
|
||||
|
||||
logs.debug(f"{ctx.author.name} location: {location}")
|
||||
|
||||
# START LANGUAGES
|
||||
await ctx.send(
|
||||
embed=embeds.simple_question_100("Which languages do you speak?"),
|
||||
embed=embeds_old.simple_question_100("Which languages do you speak?"),
|
||||
content=f"Recorded answer: {location}"
|
||||
)
|
||||
|
||||
|
@ -259,7 +259,7 @@ class BasicCog(commands.Cog):
|
|||
|
||||
# START PRONOUNS
|
||||
await ctx.send(
|
||||
embed=embeds.simple_question_30("What are your preferred pronouns?"),
|
||||
embed=embeds_old.simple_question_30("What are your preferred pronouns?"),
|
||||
content=f"Recorded answer: {languages}")
|
||||
|
||||
try:
|
||||
|
@ -272,7 +272,7 @@ class BasicCog(commands.Cog):
|
|||
|
||||
# START SEXUALITY
|
||||
await ctx.send(
|
||||
embed=embeds.simple_question_30("What's your sexuality?"),
|
||||
embed=embeds_old.simple_question_30("What's your sexuality?"),
|
||||
content=f"Recorded answer: {pronouns}")
|
||||
|
||||
try:
|
||||
|
@ -285,7 +285,7 @@ class BasicCog(commands.Cog):
|
|||
|
||||
# START RELATIONSHIP_STATUS
|
||||
await ctx.send(
|
||||
embed=embeds.simple_question_30("What's your current relationship status?"),
|
||||
embed=embeds_old.simple_question_30("What's your current relationship status?"),
|
||||
content=f"Recorded answer: {sexuality}")
|
||||
|
||||
try:
|
||||
|
@ -298,7 +298,7 @@ class BasicCog(commands.Cog):
|
|||
logs.debug(f"{ctx.author.name} relationship_status: {relationship_status}")
|
||||
|
||||
# START LIKES
|
||||
await ctx.send(embed=embeds.simple_question_300("Likes & interests"),
|
||||
await ctx.send(embed=embeds_old.simple_question_300("Likes & interests"),
|
||||
content=f"Recorded answer: {relationship_status}")
|
||||
|
||||
try:
|
||||
|
@ -310,7 +310,7 @@ class BasicCog(commands.Cog):
|
|||
logs.debug(f"{ctx.author.name} likes: {likes}")
|
||||
|
||||
# START DISLIKES
|
||||
await ctx.send(embed=embeds.simple_question_300("Dislikes"),
|
||||
await ctx.send(embed=embeds_old.simple_question_300("Dislikes"),
|
||||
content=f"Recorded answer: {likes}")
|
||||
|
||||
try:
|
||||
|
@ -323,7 +323,7 @@ class BasicCog(commands.Cog):
|
|||
logs.debug(f"{ctx.author.name} dislikes: {dislikes}")
|
||||
|
||||
# START EXTRA
|
||||
await ctx.send(embed=embeds.simple_question_300(
|
||||
await ctx.send(embed=embeds_old.simple_question_300(
|
||||
"EXTRAS: job status, zodiac sign, hobbies, etc. "
|
||||
"Tell us about yourself!"),
|
||||
content=f"Recorded answer: {dislikes}")
|
||||
|
@ -338,7 +338,7 @@ class BasicCog(commands.Cog):
|
|||
logs.debug(f"{ctx.author.name} extra: {extra}")
|
||||
|
||||
# POST EXAMPLE EMBED AND FINAL IF APPROVED
|
||||
em = embeds.final_embed_extended(ctx, nickname, age, location,
|
||||
em = embeds_old.final_embed_extended(ctx, nickname, age, location,
|
||||
languages, pronouns, sexuality,
|
||||
relationship_status, likes,
|
||||
dislikes, extra)
|
||||
|
@ -352,60 +352,60 @@ class BasicCog(commands.Cog):
|
|||
intro_channel = guild.get_channel(channel_id)
|
||||
await intro_channel.send(embed=em,
|
||||
content=f"Introduction of <@{ctx.author.id}>")
|
||||
await ctx.send(embed=embeds.final_confirmation(channel_id))
|
||||
await ctx.send(embed=embeds_old.final_confirmation(channel_id))
|
||||
logs.info(f"[CommandHandler] {ctx.author.name} introduction was submitted.")
|
||||
return
|
||||
else:
|
||||
await ctx.send(embed=embeds.no_time())
|
||||
await ctx.send(embed=embeds_old.no_time())
|
||||
logs.warning(f"{ctx.author.id} Intro Timeout")
|
||||
return
|
||||
|
||||
except asyncio.TimeoutError:
|
||||
await ctx.send(embed=embeds.no_time())
|
||||
await ctx.send(embed=embeds_old.no_time())
|
||||
logs.warning(f"{ctx.author.id} Intro Timeout")
|
||||
return
|
||||
|
||||
except asyncio.TimeoutError:
|
||||
await ctx.send(embed=embeds.no_time())
|
||||
await ctx.send(embed=embeds_old.no_time())
|
||||
logs.warning(f"{ctx.author.id} Intro Timeout")
|
||||
return
|
||||
|
||||
except asyncio.TimeoutError:
|
||||
await ctx.send(embed=embeds.no_time())
|
||||
await ctx.send(embed=embeds_old.no_time())
|
||||
logs.warning(f"{ctx.author.id} Intro Timeout")
|
||||
return
|
||||
|
||||
except asyncio.TimeoutError:
|
||||
await ctx.send(embed=embeds.no_time())
|
||||
await ctx.send(embed=embeds_old.no_time())
|
||||
logs.warning(f"{ctx.author.id} Intro Timeout")
|
||||
return
|
||||
|
||||
except asyncio.TimeoutError:
|
||||
await ctx.send(embed=embeds.no_time())
|
||||
await ctx.send(embed=embeds_old.no_time())
|
||||
logs.warning(f"{ctx.author.id} Intro Timeout")
|
||||
return
|
||||
|
||||
except asyncio.TimeoutError:
|
||||
await ctx.send(embed=embeds.no_time())
|
||||
await ctx.send(embed=embeds_old.no_time())
|
||||
logs.warning(f"{ctx.author.id} Intro Timeout")
|
||||
return
|
||||
|
||||
except asyncio.TimeoutError:
|
||||
await ctx.send(embed=embeds.no_time())
|
||||
await ctx.send(embed=embeds_old.no_time())
|
||||
logs.warning(f"{ctx.author.id} Intro Timeout")
|
||||
return
|
||||
|
||||
except asyncio.TimeoutError:
|
||||
await ctx.send(embed=embeds.no_time())
|
||||
await ctx.send(embed=embeds_old.no_time())
|
||||
logs.warning(f"{ctx.author.id} Intro Timeout")
|
||||
return
|
||||
|
||||
except asyncio.TimeoutError:
|
||||
await ctx.send(embed=embeds.no_time())
|
||||
await ctx.send(embed=embeds_old.no_time())
|
||||
logs.warning(f"{ctx.author.id} Intro Timeout")
|
||||
return
|
||||
else:
|
||||
await ctx.send(embed=embeds.no_time())
|
||||
await ctx.send(embed=embeds_old.no_time())
|
||||
logs.warning(f"{ctx.author.id} Intro Timeout")
|
||||
return
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import discord
|
|||
from discord.ext import commands
|
||||
|
||||
from services.Xp import Xp
|
||||
from lib import embeds, checks
|
||||
from lib import embeds_old, checks
|
||||
|
||||
|
||||
class LevelCog(commands.Cog):
|
||||
|
|
Loading…
Reference in a new issue