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

Parameters? #742

Open
emman123667 opened this issue Sep 29, 2020 · 3 comments
Open

Parameters? #742

emman123667 opened this issue Sep 29, 2020 · 3 comments

Comments

@emman123667
Copy link

Is it possible to include parameters in commands?

@PixeLInc
Copy link
Contributor

What do you mean by parameters, something like !command arg1 arg2? if so, yes!
You can check out the example over at https://github.com/discordrb/discordrb/blob/master/examples/commands.rb
More specifically line 33 which shows using 2 arguments that the user can pass.

Also just going to repost this, please join https://discord.gg/discord-api for further support since it's far easier to chat about it in our channel rather than making a bunch of issues.
Thanks!

@eldyj
Copy link

eldyj commented Jul 19, 2022

Is it possible to include parameters in commands?

Sure

#some params
bot.command :command do | event, arg1, arg2, arg3 | # !command a b c -> arg1, arg2, arg3 = 'a', 'b', 'c'
    #code
end

#all params
bot.command :command do | event, *args | # !command a a a -> args = ['a', 'a', 'a']
    #code
end

@Daniel-Worrall
Copy link
Contributor

Please note:

The source of discordrb has been moved to the shardlab org.

The gem is also being updated using shardlab/discordrb as the new source.

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

4 participants