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

Make "…" trigger a note #257

Open
electron271 opened this issue Jan 8, 2024 · 1 comment
Open

Make "…" trigger a note #257

electron271 opened this issue Jan 8, 2024 · 1 comment

Comments

@electron271
Copy link
Contributor

Some keyboards like to do this symbol instead of ....

After looking in the code this may be a bit harder to implement

ⓘ Jump to line

  command :note, {
    aliases: %i[n ..],

The aliases part relies on there already being a period at the beginning, but since this is a unicode character this is not the case. The only way it seems would be to rewrite the aliases bit to not always expect there to be a period at the beginning, which would also mean rewriting many commands.

I have no idea how the command system works internally and I cannot find much information about it, however it is possible that it is baked into discordrb which would be a bit more annoying.

Closest I could find is this, however as I do not know ruby I am unsure.
ⓘ Jump to line

  # A command that references another command
  class CommandAlias
    # @return [Symbol] the name of this alias
    attr_reader :name

    # @return [Command] the command this alias points to
    attr_reader :aliased_command

    def initialize(name, aliased_command)
      @name = name
      @aliased_command = aliased_command
    end
  end

I cannot help with actually developing this much as ruby does not want to work for me, however I can still write (some) code.

@anna328p
Copy link
Collaborator

anna328p commented Jan 8, 2024

The command system is indeed baked into discordrb. I basically had to read the source code to understand it.

I could add this feature in a different way, though, by moving the command logic into a separate method, and adding a message event handler that runs on messages starting with .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants