Coder Social home page Coder Social logo

Comments (5)

Katrix avatar Katrix commented on August 30, 2024

The default behavior for commands is to require a mention. Did you do that? @MyBot !ping? This is done to help combat the problem of hogging common prefixes for commands.

from ackcord.

dienzo76 avatar dienzo76 commented on August 30, 2024

I actually did try that and when i do it the bot reply with "No more arguments left" and if i put an arg like this "@testbot !ping hello" it will reply "For input string: "hello" i don't understand why it doesn't reply with "Received ping command with arg" since the code is this
{ override def handle(msg: Message, args: Int, remaining: List[String])(implicit c: CacheSnapshot[Id]): Unit = println(s"Received ping command with arg $args") }
Sorry if it's a silly question i'm a beginner in programming.
Thanks in advance.

from ackcord.

Katrix avatar Katrix commented on August 30, 2024

Welp, I screwed up the example bot commands. Sorry about that. What's happening here is that the second argument is the "parsed" argument. Here it expects a number, but you never give it one. As for if you give it a string, I've later come to learn in other projects that not all exception messages are fine to pass unhandled to the user. If you change the args: Int to args: NotUsed it should work fine. Remember to also change CommandHandler[Int] to CommandHandler[NotUsed]. Alternatively, you can provide a number when you invoke the command like so. @MyBot !ping 5.

Lastly, while you can follow the example bot found on master, and that one might contain fixes, it will probably also contain other future changes. Preferably 0.11 would already be out, but my connection was crap last time I tried to publish, and I'm on vacation atm. If you want code that is guaranteed to work with 0.10, check out the repository at that point instead. https://github.com/Katrix/AckCord/tree/7db2e5c5499a4bf7e97eaaad3725ee768486f5da

from ackcord.

Katrix avatar Katrix commented on August 30, 2024

Should be fixed in master

from ackcord.

dienzo76 avatar dienzo76 commented on August 30, 2024

Sorry i totally forgot about this, thanks I will check it out again 😄

from ackcord.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.