Skip to content

Commit 870c00e

Browse files
committed
PrintColors is now a website + AutoKick changed for multiple server
Signed-off-by: Infi <infiziert@protonmail.ch>
1 parent 504357a commit 870c00e

3 files changed

Lines changed: 11 additions & 16 deletions

File tree

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ All commands start with `<<`. Enter parameters after a space (see below for exam
2424
| Command | Description | Parameter(s) |
2525
| -------- | ----------- | ------------------ |
2626
| Help | Prints a list of all commands | |
27-
| PrintColors | Prints a list of all colors | |
27+
| PrintColors | https://nayu.moe/colors | |
2828
| NewColor | Assign a random color to the current user | |
2929
| NewColor | Assign the specified color to the current user | ColorName |
30-
| PreviewColor | Assign the specified color to the bot | ColorName |
30+
| PreviewColor | Post a preview image of the color | ColorName |
3131

3232
### Admin-only commands
3333

3434
| Command | Description | Parameter(s) |
3535
| -------- | ----------- | ------------------ |
3636
| NewServer | Generate all color roles on this server | |
37-
| AddColorAllMember | Assigns a random color role to all current members | |
37+
| AddColorToAllMember | Assigns a random color role to all current members | |
3838
| RemoveAllColors | Removes all color roles from the server | |
3939
| ReloadColors | Add all new colors to your server | |
4040

@@ -48,7 +48,7 @@ where you can add new colors. Afterwards, use the command `<<ReloadColors`
4848
to create the color role(s).
4949

5050
## Auto Kick
51-
When `var AutoKick` is `true`:
51+
If you want it, just add your ServerID into `AutoKickOnServer`
5252

5353
All new members will be kicked after 30 minutes if they do not have at
5454
least one additional role (i. e. a role that is not just a color).

config.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
BotToken: "YOUR_BOT_TOKEN"
22
InviteLink: "https://discord.gg/V5vaWwr"
3-
AutoKick: true
3+
AutoKickOnServer: {
4+
"ServerID": "ServerName"
5+
}
46
SpamChannel: "Channel_ID"
57
Admins: {
68
"134750562062303232": "Infi",

main.go

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"time"
1010
"math/rand"
1111
"strings"
12-
"bytes"
1312
"image"
1413
"image/draw"
1514
"log"
@@ -22,7 +21,7 @@ import (
2221
type Config struct {
2322
BotToken string `yaml:"BotToken"`
2423
InviteLink string `yaml:"InviteLink"`
25-
AutoKick bool `yaml:"AutoKick"`
24+
AutoKickOnServer map[string]string `yaml:"AutoKickOnServer"`
2625
SpamChannel string `yaml:"SpamChannel"`
2726
Admins map[string]string `yaml:"Admins"`
2827
Colors map[string]int `yaml:"Colors"`
@@ -40,7 +39,7 @@ var (
4039
CreatedRoles = map[string]map[string]Roles{}
4140
FirstTime = true
4241
HelpText = `Help for Color-Bot
43-
<<PrintColors "Prints a list of all colors"
42+
<<PrintColors https://nayu.moe/colors
4443
<<NewColor "Assign a random color to the current user"
4544
<<NewColor ColorName "Assign the specified color to the current user"
4645
<<PreviewColor ColorName "Post a preview image of the color"`
@@ -162,13 +161,7 @@ func OnMessage(session *discordgo.Session, msg *discordgo.MessageCreate) {
162161
}
163162
session.ChannelMessageDelete(msg.ChannelID, msg.ID)
164163
} else if strings.HasPrefix(msg.Content, "<<PrintColors") {
165-
var buffer bytes.Buffer
166-
for key := range config.Colors {
167-
buffer.WriteString(key + "\n")
168-
}
169-
buffer.WriteString("Use `<<PreviewColor ColorName` for a preview.")
170-
171-
SendMessageAndDeleteAfterTime(session, msg.ChannelID, buffer.String())
164+
SendMessageAndDeleteAfterTime(session, msg.ChannelID, "https://nayu.moe/colors")
172165
session.ChannelMessageDelete(msg.ChannelID, msg.ID)
173166
} else if strings.HasPrefix(msg.Content, "<<Help") {
174167
SendMessageAndDeleteAfterTime(session, msg.ChannelID, HelpText)
@@ -197,7 +190,7 @@ func OnMessage(session *discordgo.Session, msg *discordgo.MessageCreate) {
197190

198191
func OnMemberJoin(session *discordgo.Session, Member *discordgo.GuildMemberAdd) {
199192
UpdateMemberColorRandom(session, Member.GuildID, Member.User.ID)
200-
if config.AutoKick {
193+
if _, ok := config.AutoKickOnServer[Member.GuildID]; ok {
201194
go KickMemberAfterTime(session, Member.GuildID, Member.User.ID)
202195
}
203196
}

0 commit comments

Comments
 (0)