Skip to content

jamfromouterspace/banter-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Linux Banter Bot

Adding a command

Please include any command you add in the HELP_REPLY string.

Simple commands

All standard commands are automatically preceded by "bot", so there is no need to add that. Simply add the command name and resolver function to the commandMap object:

const commandMap = {
  ...
  "newcommand": resolverFunction
  ...
}

For example,

const commandMap = {
  ...
  "foo": () => reply("bar")
}

Note that reply is a standard function used by other commands too. Only put function definitions in the commandMap if they are short. If they exceed one short line, then define the function somewhere else and reference it:

const bar = () => {
  // Do something more involved
}
const commandMap = {
  ...
  "foo": bar
}

Nested commands

For nested commands, such as bot echo sticker, you can define the command as an object:

const commandMap = {
  ...
  "foo": {
    default: doDefault, // "bot foo" (set this to invalidCommand if it's not allowed)
    "bar": doSomething, // "bot foo bar"
    "baz": doSomethingElse, // "bot foo baz"
  }
}

See the "echo" command for a concrete example. You can nest as deeply as you want!

Environment

  • node-telegram-bot
  • Start command: yarn start
  • Node version 13.3.0
  • yarn
  • Secret config goes in .env file at root (read by dotenv package)

Git Conventions

Conventional commits

  • [feat/chore/docs/fix/refactor/...]: lowercase present-tense message
  • Example: "feat: send random sticker every 30 seconds"
  • P.S. This is enforced by the git hook commit-msg
  • Exception: merge commit messages are free-form
  • More info

Branching model

  • master, dev, and [feature]
  • Work on a feature branch, merge into dev, merge dev into master for major release
  • Commit with --no-ff flag to add a message
  • More info

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •