mirror of
https://github.com/wlinator/luminara.git
synced 2024-10-02 20:23:12 +00:00
Make logs more clear
This commit is contained in:
parent
4ad965e8b2
commit
883e04a55c
9 changed files with 54 additions and 27 deletions
7
main.py
7
main.py
|
@ -251,7 +251,7 @@ def load_cogs():
|
|||
try:
|
||||
sbbot.load_extension(module_name)
|
||||
loaded_modules.add(filename)
|
||||
racu_logs.info(f"Module {filename} loaded.")
|
||||
racu_logs.info(f"Module {filename[:-3].upper()} loaded.")
|
||||
|
||||
except Exception as e:
|
||||
racu_logs.error(f"Failed to load module {filename}: {e}")
|
||||
|
@ -264,6 +264,8 @@ if __name__ == '__main__':
|
|||
"""
|
||||
|
||||
racu_logs.info("RACU IS BOOTING")
|
||||
racu_logs.info("\n")
|
||||
|
||||
load_dotenv('.env')
|
||||
|
||||
# load db
|
||||
|
@ -271,4 +273,7 @@ if __name__ == '__main__':
|
|||
# Item.insert_items()
|
||||
|
||||
load_cogs()
|
||||
|
||||
# empty line to separate modules from system info in logs
|
||||
racu_logs.info("\n")
|
||||
sbbot.run(os.getenv('TOKEN'))
|
||||
|
|
46
modules/balance.py
Normal file
46
modules/balance.py
Normal file
|
@ -0,0 +1,46 @@
|
|||
import json
|
||||
import os
|
||||
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from data.Currency import Currency
|
||||
from sb_tools import universal
|
||||
|
||||
load_dotenv('.env')
|
||||
|
||||
special_balance_name = os.getenv("SPECIAL_BALANCE_NAME")
|
||||
cash_balance_name = os.getenv("CASH_BALANCE_NAME")
|
||||
|
||||
|
||||
class BalanceCog(commands.Cog):
|
||||
def __init__(self, sbbot):
|
||||
self.bot = sbbot
|
||||
|
||||
@commands.slash_command(
|
||||
name="balance",
|
||||
description="See how much cash you have.",
|
||||
guild_only=True
|
||||
)
|
||||
@commands.check(universal.channel_check)
|
||||
async def balance(self, ctx):
|
||||
# Currency handler
|
||||
ctx_currency = Currency(ctx.author.id)
|
||||
|
||||
cash_balance = Currency.format(ctx_currency.cash)
|
||||
special_balance = Currency.format(ctx_currency.special)
|
||||
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.embed_background(),
|
||||
description=f"**Cash**: {cash_balance_name}{cash_balance}\n"
|
||||
f"**{special_balance_name.capitalize()}**: {special_balance}"
|
||||
)
|
||||
embed.set_author(name=f"{ctx.author.name}'s wallet", icon_url=ctx.author.avatar.url)
|
||||
embed.set_footer(text=f"Level up to earn {special_balance_name}!")
|
||||
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
|
||||
def setup(sbbot):
|
||||
sbbot.add_cog(BalanceCog(sbbot))
|
|
@ -17,34 +17,10 @@ with open("config/economy.json") as file:
|
|||
json_data = json.load(file)
|
||||
|
||||
|
||||
class EconomyCog(commands.Cog):
|
||||
class AwardCog(commands.Cog):
|
||||
def __init__(self, sbbot):
|
||||
self.bot = sbbot
|
||||
|
||||
@commands.slash_command(
|
||||
name="balance",
|
||||
description="See how much cash you have.",
|
||||
guild_only=True
|
||||
)
|
||||
@commands.check(universal.channel_check)
|
||||
async def balance(self, ctx):
|
||||
|
||||
# Currency handler
|
||||
ctx_currency = Currency(ctx.author.id)
|
||||
|
||||
cash_balance = Currency.format(ctx_currency.cash)
|
||||
special_balance = Currency.format(ctx_currency.special)
|
||||
|
||||
embed = discord.Embed(
|
||||
color=discord.Color.embed_background(),
|
||||
description=f"**Cash**: {cash_balance_name}{cash_balance}\n"
|
||||
f"**{special_balance_name.capitalize()}**: {special_balance}"
|
||||
)
|
||||
embed.set_author(name=f"{ctx.author.name}'s wallet", icon_url=ctx.author.avatar.url)
|
||||
embed.set_footer(text=f"Level up to earn {special_balance_name}!")
|
||||
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@commands.slash_command(
|
||||
name="give",
|
||||
description="Give another user some currency.",
|
||||
|
@ -127,4 +103,4 @@ class EconomyCog(commands.Cog):
|
|||
|
||||
|
||||
def setup(sbbot):
|
||||
sbbot.add_cog(EconomyCog(sbbot))
|
||||
sbbot.add_cog(AwardCog(sbbot))
|
Loading…
Reference in a new issue