ire4ever1190 / dimscmd Goto Github PK
View Code? Open in Web Editor NEWA command handler for dimscord
License: MIT License
A command handler for dimscord
License: MIT License
It could look like this, not too sure about multiple options
proc foo(bar: string) {.slash_command.} =
## Foo some bars
discard await discord.api.sendMessage(m.channel_id, "Foo be spitting dem bars tho.")
Currently I have a proc which generates a help message but it's unused
Biggest issue is coming up with a nice layout so it looks good. Will most likely copy how other libs do it
Return an error message to the user if they entered a command incorrectly e.g.
cmd.addChat("square") do (num: int):
# square the number and send back
user: $$square seven
bot: Expected number but got "seven"
For some reason devel runs into either a memory leak or infinite loop when deleting memory
Example
/home/runner/work/dimscmd/dimscmd/tests/testCommands.nim(317) testCommands
/home/runner/.choosenim/toolchains/nim-#devel/lib/pure/asyncdispatch.nim(2022) waitFor
/home/runner/.choosenim/toolchains/nim-#devel/lib/pure/asyncdispatch.nim(1711) poll
/home/runner/.choosenim/toolchains/nim-#devel/lib/pure/asyncdispatch.nim(1452) runOnce
/home/runner/.choosenim/toolchains/nim-#devel/lib/system.nim(27) processPendingCallbacks
/home/runner/.choosenim/toolchains/nim-#devel/lib/system/arc.nim(179) nimDestroyAndDispose
/home/runner/.choosenim/toolchains/nim-#devel/lib/system/arc.nim(179) nimDestroyAndDispose
/home/runner/.choosenim/toolchains/nim-#devel/lib/system/arc.nim(179) nimDestroyAndDispose
...
discord.py allows you to specify a list or callable (which returns a list) for the prefix and I'd like to add that.
This would be important to find what shard it came from, gateway ping, status of the gateway, etc.
Add easy syntax to support autocomplete. Current idea at the moment is
proc nameComplete(i: Interaction, current: string) {.async.} =
discard
cmd.addSlash("ping") do (name {.complete: nameComplete.}: string) {.async.} =
echo name
I think its a bit verbose though so might improve it once I play around with auto complete for a bit
As reading source, this line
in addCommand
needs description, but addSlash
(link) doesn't provide argument for description.
From example of dimscmd provides the code: cmd.addSlash("add") do (a: int, b: int):
we should be able to add argument for description or make description is not required.
Maybe am I missing something or I have to provide description via parameters? Sorry if I didn't understand it correctly.
From
Line 171 in 6399e53
int
and string
are the supported types. Lets see if we can't add User/Member, Role, Channel, and Guild types.
it would parse full names (eg: William_CTO#5415), pings/mentions @William_CTO (which is really <@!ID>
), etc
This could then return the id of the user/role/channel, etc or a User object, etc fetched from the Discord API
Investigate if I validate that sub command names are all of correct size
If I don't, add proper error message
Currently the macros for parameters since the line info to be inside dismcmd. Having it set to be where the user actually defines the parameter will make it a lot clearer if any issues popup
Using a function such as cmd.addChat("hello") do (user: Option[User])
may output "$id is not a proper userID" even though the ID is correct.
Some of my own logic showed that user.isNone == true
.
Try to run a command on any User ID with 19 digits (ex: 1002133811397656709)
Commands run as expected on 19 digits ids.
Have been discussing this issue on the Dimscord server as ieltan#5830.
Will save needing to set a guild ID for everything when wanting to switch between debug/release
there's only aliases for chat commands and not for slash commands, which would be very useful
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.