krisppurg / dimscord

A Discord Bot & REST Library for Nim.
https://krisppurg.github.io/dimscord/
MIT License
222 stars 20 forks source link

`MessageComponent` helpers now accept `openArray`/`varargs` where appropriate #116

Closed ire4ever1190 closed 1 year ago

ire4ever1190 commented 1 year ago

Noticed while looking at #115 that newActionRow required a seq when it wasn't really required. It now takes varargs instead so that it can now be called like

  let
    # Existing uses still work
    a = newActionRow(@[MessageComponent()])
    # Can just pass an array
    b = newActionRow([MessageComponent()])
    # Can just pass a series of components
    c = newActionRow(MessageComponent(), MessageComponent())
krisppurg commented 1 year ago

I think the example also needs to be updated as well? (examples/message_components.nim)

ire4ever1190 commented 1 year ago

Example is fine since the components are appended to row instead of being created with it (Wouldn't need to be updated anyways since this doesn't break anything). I did notice that newSelectMenu could be switch to use openArray though so have added that into this PR (Also doesn't break old code)