Code Monkey home page Code Monkey logo

Comments (6)

adam757521 avatar adam757521 commented on July 25, 2024 2

Hey! Thanks for using our library!
Making a leaderboard with discordSuperUtils is a VERY easy task.
simply,

@bot.command()
async def leaderboard(ctx):
    guild_leaderboard = LevelingManager.get_leaderboard(ctx.guild)[:10]
    formatted_leaderboard = [f"Member: {x.member}, XP: {x.xp}" for x in guild_leaderboard]

    await discordSuperUtils.PageManager(ctx, discordSuperUtils.generate_embeds(
        formatted_leaderboard,
        title="Leveling Leaderboard",
        fields=25,
        description=f"Leaderboard of {ctx.guild}"
    )).run()

If you have any other questions, take a look at our documentation, alternatively, join our discord server!

from discord-super-utils.

adam757521 avatar adam757521 commented on July 25, 2024 1

That issue will be fixed in the next release, it will be released later today

from discord-super-utils.

Volverine avatar Volverine commented on July 25, 2024

Its working only with one person but if there is more people on the leaderboard it gets error:
Smth with other.net i guess
self.net is working fine.

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "bot4.py", line 29, in leaderboard
    guild_leaderboard = LevelingManager.get_leaderboard(ctx.guild)[:10]
  File "/serv/bot4/discordSuperUtils/Leveling.py", line 122, in get_leaderboard
    members.sort()
  File "/serv/bot4/discordSuperUtils/Leveling.py", line 26, in __lt__
    return self.net < other.net
AttributeError: 'LevelingAccount' object has no attribute 'net'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/usr/local/lib/python3.7/dist-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/usr/local/lib/python3.7/dist-packages/discord/ext/commands/core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'LevelingAccount' object has no attribute 'net'```

from discord-super-utils.

adam757521 avatar adam757521 commented on July 25, 2024

0.1.3 has been released, that issue has been fixed.

from discord-super-utils.

Volverine avatar Volverine commented on July 25, 2024

image

The order is wrong, any way to fix this without downloading whole release? Last time i couldnt import my database and we had to start collecting our levels from the beginning :P

from discord-super-utils.

adam757521 avatar adam757521 commented on July 25, 2024

Yes, the reversed function to reverse the order.
We should make it reversed by default, sorry.

from discord-super-utils.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.