Skip to content

Commit

Permalink
rebranding to Tagioalisi
Browse files Browse the repository at this point in the history
  • Loading branch information
fsufitch committed Feb 11, 2020
1 parent 5730231 commit 9ce255c
Show file tree
Hide file tree
Showing 23 changed files with 45 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .env.template
Expand Up @@ -4,6 +4,6 @@ WEB_ENABLED=true
WEB_SECRET=secret123
DISCORD_TOKEN=XXXXXXXXXXXXXXXX
DISCORD_LOG_CHANNEL=327526752203177984
DATABASE_URL=postgres://boarbot:secret@db:5432/boarbot?sslmode=disable
DATABASE_URL=postgres://tagi:secret@db:5432/tagi?sslmode=disable
BLACKLIST_BOT_MODULES=
MIGRATION_DIR=./db/migration
6 changes: 3 additions & 3 deletions Dockerfile
Expand Up @@ -9,7 +9,7 @@ RUN go mod download
FROM deps

ADD . /bot
RUN go build ./cmd/discord-boar-bot
RUN go build ./cmd/boarbot-migrate
RUN go build ./cmd/tagi-bot
RUN go build ./cmd/tagi-migrate

CMD [ "./discord-boar-bot" ]
CMD [ "./tagi-bot" ]
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 Filip Sufitchi
Copyright (c) 2020 Filip Sufitchi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Procfile
@@ -1 +1 @@
web: bin/discord-boar-bot
web: bin/tagi-bot
24 changes: 18 additions & 6 deletions README.md
@@ -1,5 +1,17 @@
# discord-boar-bot
Custom bot for the Sociologic Planning Boar. Now in Go!
# Tagioalisi

> Formerly _discord-boar-bot_
Custom bot for the Sociologic Planning Boar server on Discord. Now in Go!

, _______________
`-. \ .-' < Hello, world! >
,-"`````""-\__ | / ---------------
'-.._ _.-'` '-o, /
_>--:{{< ) |) /
.-'' '-.__.-o`
'-._____..-/` | \
,-' / `-.

### Python to Go Migration

Expand All @@ -17,7 +29,7 @@ delivery of the following items:
- [x] The following bot modules: ~~ping~~, ~~log~~, ~~memelink~~, ~~sockpuppet~~ (incl. ~~linking with web API~~), ~~groups~~
- [ ] Single page web UI for interacting with the web API
- [ ] Two stage deployment setup for integration testing on Heroku
- [ ] Rebranding to something not related to Guild Wars 2; who plays that game anyway?
- [x] Rebranding to something not related to Guild Wars 2; who plays that game anyway?

## Requirements

Expand All @@ -28,8 +40,8 @@ delivery of the following items:

The bot provides two executable entry points, which can be built with these commands:

go build ./cmd/discord-boar-bot
go build ./cmd/boarbot-migrate
go build ./cmd/tagi-bot
go build ./cmd/tagi-migrate

The executables produced by these packages are ready to be run anywhere. They are configured
using environment variables. An example configuration for local development can be found
Expand All @@ -45,7 +57,7 @@ The bot comes with a `Dockerfile` and `docker-compose.yml` to ease setup. To set
running bot, follow these steps.

1. Copy `.env.template` into `.env` and edit it so `DISCORD_TOKEN` contains a valid Discord bot token
2. Run `docker compose run ./boarbot-migrate` to set up the database
2. Run `docker-compose run bot ./tagi-migrate` to set up the database
3. Run `docker up` (with `--build` after every time you make code changes)

## Configuration
Expand Down
6 changes: 3 additions & 3 deletions bot/bot.go
Expand Up @@ -14,16 +14,16 @@ type Bot interface {
Run(context.Context) error
}

// DiscordBoarBot is the concrete implementation of Bot
type DiscordBoarBot struct {
// TagioalisiBot is the concrete implementation of Bot
type TagioalisiBot struct {
Log *log.Logger
Modules ModuleList
ModuleBlacklist config.BotModuleBlacklist
Token config.DiscordBotToken
}

// Run is a blocking function that holds the runtime of the Discord bot
func (b DiscordBoarBot) Run(ctx context.Context) error {
func (b TagioalisiBot) Run(ctx context.Context) error {
session, err := discordgo.New("Bot " + string(b.Token))
if err != nil {
return errors.Wrap(err, "could not create bot session")
Expand Down
2 changes: 1 addition & 1 deletion bot/memelink-module/acl.go
Expand Up @@ -2,7 +2,7 @@ package memelink

import "github.com/bwmarrin/discordgo"

const memeEditorACL = "boarbot.modules.memelink::edit"
const memeEditorACL = "boarbot.modules.memelink::edit" // TODO: rename to tagi namespace once ACL is more easily editable

// TODO: change to (bool, err) return type to bubble errors up
func (m Module) isMemeEditor(s *discordgo.Session, userID string, guildID string) bool {
Expand Down
3 changes: 0 additions & 3 deletions bot/todo.txt
@@ -1,5 +1,2 @@
dice
groups
memelink
welcome
remindme
8 changes: 4 additions & 4 deletions bot/wire.go
Expand Up @@ -9,10 +9,10 @@ import (
"github.com/google/wire"
)

// ProvideDiscordBoarBot contains all the necessary wire providers to stand up a Discord Boar Bot
var ProvideDiscordBoarBot = wire.NewSet(
wire.Struct(new(DiscordBoarBot), "*"),
wire.Bind(new(Bot), new(*DiscordBoarBot)),
// ProvideTagioalisiBot contains all the necessary wire providers to stand up a Tagioalisi Bot
var ProvideTagioalisiBot = wire.NewSet(
wire.Struct(new(TagioalisiBot), "*"),
wire.Bind(new(Bot), new(*TagioalisiBot)),
wire.Struct(new(Modules), "*"),
ProvideModuleList,
ping.ProvideModule,
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion cmd/discord-boar-bot/web.go → cmd/tagi-bot/web.go
Expand Up @@ -9,7 +9,7 @@ import (
type WebRunFunc func() error

// ProvideWebRunFunc assigns the appropriate web run function
func ProvideWebRunFunc(webEnabled config.WebEnabled, server web.BoarBotServer) WebRunFunc {
func ProvideWebRunFunc(webEnabled config.WebEnabled, server web.TagioalisiAPIServer) WebRunFunc {
if !webEnabled {
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/discord-boar-bot/wire.go → cmd/tagi-bot/wire.go
Expand Up @@ -19,7 +19,7 @@ func InitializeMain() (Main, func(), error) {
ProvideWebRunFunc,
config.EnvironmentProviderSet,
log.CLILoggingProviderSet,
bot.ProvideDiscordBoarBot,
bot.ProvideTagioalisiBot,
db.ProvidePostgresDatabase,
web.ProvideWebServer,
))
Expand Down
8 changes: 4 additions & 4 deletions cmd/discord-boar-bot/wire_gen.go → cmd/tagi-bot/wire_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion db/provider.go
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/google/wire"
)

// ProvidePostgresDatabase contains all the necessary wire providers to use the Boar Bot Postgres database
// ProvidePostgresDatabase contains all the necessary wire providers to use the Tagioalisi Postgres database
var ProvidePostgresDatabase = wire.NewSet(
connection.ProvidePostgresDatabaseConnection,
wire.Struct(new(kv.DAO), "*"),
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Expand Up @@ -11,6 +11,6 @@ services:
db:
image: "postgres:12"
environment:
POSTGRES_USER: boarbot
POSTGRES_USER: tagi
POSTGRES_PASSWORD: secret
POSTGRES_DB: boarbot
POSTGRES_DB: tagi
Binary file added logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions web/server.go
Expand Up @@ -9,15 +9,15 @@ import (
"github.com/gorilla/mux"
)

// BoarBotServer is the webserver of the boar bot
type BoarBotServer struct {
// TagioalisiAPIServer is the API webserver of Tagioalisi
type TagioalisiAPIServer struct {
WebPort config.WebPort
Log *log.Logger
Router Router
}

// Run is a blocking function that starts and serves the web API
func (s BoarBotServer) Run() error {
func (s TagioalisiAPIServer) Run() error {
serv := &http.Server{
Addr: fmt.Sprintf(":%d", s.WebPort),
Handler: (*mux.Router)(s.Router),
Expand Down
2 changes: 1 addition & 1 deletion web/wire.go
Expand Up @@ -6,7 +6,7 @@ import (

// ProvideWebServer contains all the necessary wire providers to stand up a webserver
var ProvideWebServer = wire.NewSet(
wire.Struct(new(BoarBotServer), "*"),
wire.Struct(new(TagioalisiAPIServer), "*"),
wire.Struct(new(SecretBearerAuthorizationWrapper), "*"),
ProvideRouter,
wire.Struct(new(HelloHandler), "*"),
Expand Down

0 comments on commit 9ce255c

Please sign in to comment.