Code Monkey home page Code Monkey logo

Comments (7)

Mclilzee avatar Mclilzee commented on September 23, 2024

If it is to be done correctly, I need to make a change to the backend aswell to get a proper Query where I fetch the user's points + user's current ranking in the leaderboard.

from odin-bot-v2.

ManonLef avatar ManonLef commented on September 23, 2024

Could anyone have a look at this from @TheOdinProject/odin-bot :) ?

from odin-bot-v2.

ManonLef avatar ManonLef commented on September 23, 2024

As I mentioned here: #366 I think we should consider removing this legacy command and replace it with a slash command if we proceed with having the user point retrieval as an option.

I could be a prompt like this
Screenshot 2023-07-31 at 01 53 51

We have decided to keep a few legacy commands that are often used in sentences like this:

It would be best if you use the !question template

or

Below you will find some ways to share your !code

or

we don't support !windows
the below bot output should give you more information on how you can proceed

One of the good things about the slash commands is that they show up when entering a slash in the server, which is a great improvement compared to the old commands which people find out about when others use them or from scouring the bot repo.

I'd love to hear if other maintainers have some more feedback on the issue in particular. Perhaps there's a reason it's not working, or a deliberate decision made on it in the past. I've never seen that command in use to be honest.

from odin-bot-v2.

codyloyd avatar codyloyd commented on September 23, 2024

I'm quite confident that it's not working because this particular command is very old and something about either the discord API, or the points-API changed.

it predates discord allowing us to do slash commands, which is the reason it's a legacy one. I approve of fixing it and transitioning it to a slash command

from odin-bot-v2.

Mclilzee avatar Mclilzee commented on September 23, 2024

@KevinMulhern @01zulfi I would like your opinions on this since it can potentially be an expansion of previous discussions with the API we had about fetching data. I can confirm the problem is not related to the API but the bot itself is calling a function with wrong parameters. A simple fix to the bot would fix the problem but it will only allow it to fetch the user's points which is not that powerful since all users can already see their points when anyone gives them a ++.

There are 3 approaches to the problem:

  • The first is I use the /api/points to fetch all the user's data and filter them in the bot to display the user's Rank + Points. The problem with this approach is that whenever the changes to /api/points ship, which limits the data received, the bot will break. Another problem is that the endpoint /api/points/{discord_id} will have no reason to exist and will just be dead code in the backend.

  • The second is to update the backend with a query that fetches the user's Rank in the leaderboard in addition to their points and returns it back to the calling request, here is what I came up with https://github.com/Mclilzee/theodinproject/blob/points-ranking/app/controllers/api/points_controller.rb#L9C3-L18C6

  • The third approach is just to fix the command to only show the user's current points. The problem with this approach is we need a better name for the command, as slash command /rank does not make sense anymore because there is no ranking involved. we could keep it as !points but that will be a clarity conflict with the new slash command /points

from odin-bot-v2.

01zulfi avatar 01zulfi commented on September 23, 2024

Thanks for detailed write-up @Mclilzee

Haven't had the chance to think things through, but here's my gut instinct.

  1. We should definitely create & use /api/points/{discord_id}
  2. We could leverage subcommands
    • /points about for general info on commands
    • /points rank for user's points
      OR we could look at updating the leaderboard command somehow so user can get their own points easily as well

from odin-bot-v2.

Mclilzee avatar Mclilzee commented on September 23, 2024

@01zulfi I like the idea of subcommands very much.
I think the best subcommand would be for leaderboard, I'm updating the leaderboard command to be a slash command as well since it going to be related.

My PR will be done shortly, then we can discuss further changes in there.

from odin-bot-v2.

Related Issues (20)

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.