taiga

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

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

Go to latest
Published: Mar 22, 2020 License: MIT Imports: 10 Imported by: 0

README

Aisaka Taiga (逢坂•大河)

Discord

A Discord Bot written in Golang with discordgo and the Sapphire Framework

This could also serve as a real-life example of using the Sapphire framework, it is constantly up to date with the latest features of the framework.

Invite

If you want to use the bot, invite it to your server here

Running it yourself

To run this bot you need:

  • Golang 1.13+
  • PostgreSQL 9+

Fetch the code with

$ go get github.com/pollen5/taiga

That will fetch the project along with all required dependencies (Don't worry there aren't too much, I myself like to use as little dependencies as possible)

then cd to $GOPATH/src/github.com/pollen5/taiga (Use go env GOPATH to find your $GOPATH)

Copy config.json.example to config.json and replace the fields with actual values.

NOTE: For Bot token make sure you prefix it with Bot yourself or API requests will fail.

Setup a PostgreSQL database (you are on your own for that) and put the connection URI in config.json

NOTE: If you are not using SSL append ?sslmode=disable to the PostgreSQL connection URI, the SQL driver by default enables it.

You may want to edit constants/constants.go to match your settings.

Build the code:

$ go build main.go

For first time only run the executable with -initdb

$ ./main -initdb

This will connect to the given PostgreSQL database and create the required tables, once this is done you can start the bot.

$ ./main

NOTE: On Windows replace the following ./main calls to .\main.exe. Windows is stupid i know.

And success! Enjoy the results.

NOTE: Please do no contact me for help, what is written is what is written and that's all you need to know to run it so if you didn't understand something that's your fault. I'm not willing to help total noobs run a copy of the bot, instead invite the bot to your server. However I'm willing to help in bot related issues, things that aren't related to "How do i setup postgresql" and similar.

Schema Updates

Whenever i update the bot and changes happen in the database schema, just read the changes in db/schema.go and apply ALTER TABLE ADD COLUMN (whatever is in the schema) to add the column. In the future there will be an easier way update the schema but this is it for now.

Development flow

If you want to customize the bot then make sure you install spgen and run it when a new command is added or it's existing information (not code) changes.

See the spgen page for more information on how it works.

License

All the code here is released under the MIT LICENSE!

Do feel free to take any code from here as long as you credit me for it. (Except for very small snippets, I don't mind)

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package commands is the main entry point where all commands are registered.
Package commands is the main entry point where all commands are registered.
fun
Package constants provides some constants for use across the bot
Package constants provides some constants for use across the bot
Database interaction package.
Database interaction package.

Jump to

Keyboard shortcuts

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