crbot

command module
v0.0.0-...-f7d4230 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2025 License: MIT Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

CRBot

CRBot is a Discord bot that you can teach to respond to user-defined commands. CRBot is short for "Call and Response Bot". Commands are taught using ?learn <call> <response>, and can retrieve the response with ?call.

It works really well for media retrieval; the Discord unfurler will inline images, videos, etc.

This was initially a weekend project to see if my friends would like it. Now that they haven't banned the bot (or me), I'm in the process of turning this into something that's maintainable.

Example

Jake: ?help
crbot: Type ?help for this message, ?list to list all commands, or
       ?help <command> to get help for a particular command.

Jake: ?learn bearshrug ʅʕ•ᴥ•ʔʃ
crbot: Learned about bearshrug

One of my friends: What's the weather tomorrow?
Jake: ?bearshrug
crbot: ʅʕ•ᴥ•ʔʃ

Prerequisites

  • Redis instance, standard port, no password, DB 0
  • Add secret.json with single key, bot_token

Running

go run *.go

You have to run this with a bot account. You can register a bot account for free at the Discord site. Take the bot ID that you are given, and visit https://discordapp.com/oauth2/authorize?&client_id={$bot_id} in your browser, where {$bot_id} is replaced with the bot ID that you are given from the Discord developers site.

Maintenance

./update.sh will do some basic maintenance of the go modules.

Before sending PR

go test ./...

If your PR adds features, please add tests in system_test.go that cover your new use cases.

More reading

Blog posts:

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL