Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I started making a level command :3 #559

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions tux/cogs/fun/levels.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import discord
from discord.ext import commands

from tux.bot import Tux
from tux.ui.embeds import EmbedCreator

client = discord.Client
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Remove unused 'client' variable

This variable is assigning the Discord Client class to a variable, not instantiating it, and it's never used in the code. Consider removing it to improve code clarity.

Suggested change
client = discord.Client
# Remove the unused 'client' variable



usermessages = []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Remove unused global list 'usermessages'

This list is defined globally but never used in the code. It's best to remove unused variables to keep the code clean and prevent potential issues with global state.

Suggested change
usermessages = []
# Remove the following line:
# usermessages = []



class Levels(commands.Cog):
def __init__(self, bot: Tux) -> None:
self.bot = bot

@commands.hybrid_group(
name="level",
aliases=["lvl"],
)
@commands.guild_only()
async def main(self, ctx: commands.Context[Tux]) -> None:
embed = EmbedCreator.create_embed(
bot=self.bot,
embed_type=EmbedCreator.INFO,
user_name="Tux - EXP",
title="You are level level",
description="Your have exp exp!",
Comment on lines +27 to +28
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Implement actual level and exp calculation logic

The current implementation uses placeholder text for level and exp. Consider implementing the actual logic to calculate and display the user's level and experience points.

            title=f"You are level {user_level}",
            description=f"You have {user_exp} exp!",

)

await ctx.send(embed=embed)


async def setup(bot: Tux) -> None:
await bot.add_cog(Levels(bot))