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

Feature/join #45

Closed
wants to merge 7 commits into from
Closed

Conversation

RyanRMurray
Copy link

Added a clap and join command, as described in #44

@RyanRMurray RyanRMurray mentioned this pull request Oct 19, 2021
Comment on lines +47 to +50
[r|**Join**
Repeats the input with some interspersed string or emoji.

*Usage:* `join :clap: This text will be interspersed with claps!`|]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe clarify that the first word will be used as the string.

Comment on lines +33 to +40
clap :: Command
clap = Command "clap" (parseComm clappytime)
where
clappytime :: RestOfInput Text -> Message -> DatabaseDiscord ()
clappytime (ROI t) m =
sendMessage m $
joinify ":clap:" $
splitOn " " t
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could do clappytime :: Either (Quote Text, RestOfInput Text) RestOfInput Text -> Message -> DatabaseDiscord () to allow users to join with a string containing spaces:

join "x y" a b c d e

x y a x y b x y c x y d x y e

import Text.RawString.QQ

joinify :: Text -> [Text] -> Text
joinify sep text = sep <> " " <> (intercalate (" " <> sep <> " ") text) <> " " <> sep
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently this checks every space:

join x a b c d e

x a x b x x c x x x d x x x x e

@distributive
Copy link
Collaborator

One more bug:

  • join with no arguments throws a MessageSendException
  • clap with no arguments output ":clap: :clap:"

You could make a new exception (IOException or UserInputException) and throw that if the user doesn't provide an input.

-- Stability : experimental
-- Portability : POSIX
--
-- A command that outputs its input.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This description isn't correct

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

Successfully merging this pull request may close these issues.

3 participants