Fix objectives and add drone config
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
27
.drone.yml
Normal file
27
.drone.yml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: default
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Build
|
||||||
|
image: golang
|
||||||
|
commands:
|
||||||
|
- go get github.com/bwmarrin/discordgo
|
||||||
|
- go vet -v
|
||||||
|
- go build
|
||||||
|
- name: gitea_release
|
||||||
|
image: plugins/gitea-release
|
||||||
|
settings:
|
||||||
|
base_url: https://git.nightmare.haus
|
||||||
|
api_key:
|
||||||
|
from_secret: gitea_token
|
||||||
|
files: ./Phasmobot
|
||||||
|
checksum:
|
||||||
|
- md5
|
||||||
|
- sha1
|
||||||
|
- sha256
|
||||||
|
- sha512
|
||||||
|
- adler32
|
||||||
|
- crc32
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
77
main.go
77
main.go
@ -92,27 +92,27 @@ func readReactions(s *discordgo.Session, m *discordgo.MessageReactionAdd) {
|
|||||||
} else {
|
} else {
|
||||||
go s.MessageReactionRemove(m.ChannelID, g.PostID, m.Emoji.ID, m.UserID)
|
go s.MessageReactionRemove(m.ChannelID, g.PostID, m.Emoji.ID, m.UserID)
|
||||||
}
|
}
|
||||||
go s.MessageReactionRemove(m.ChannelID, g.PostID, fingeyEmoji, "@me")
|
s.MessageReactionRemove(m.ChannelID, g.PostID, fingeyEmoji, "@me")
|
||||||
go s.MessageReactionRemove(m.ChannelID, g.PostID, freezingEmoji, "@me")
|
s.MessageReactionRemove(m.ChannelID, g.PostID, freezingEmoji, "@me")
|
||||||
go s.MessageReactionRemove(m.ChannelID, g.PostID, spiritBoxEmoji, "@me")
|
s.MessageReactionRemove(m.ChannelID, g.PostID, spiritBoxEmoji, "@me")
|
||||||
go s.MessageReactionRemove(m.ChannelID, g.PostID, ghostWritingEmoji, "@me")
|
s.MessageReactionRemove(m.ChannelID, g.PostID, ghostWritingEmoji, "@me")
|
||||||
go s.MessageReactionRemove(m.ChannelID, g.PostID, emf5Emoji, "@me")
|
s.MessageReactionRemove(m.ChannelID, g.PostID, emf5Emoji, "@me")
|
||||||
go s.MessageReactionRemove(m.ChannelID, g.PostID, ghostOrbsEmoji, "@me")
|
s.MessageReactionRemove(m.ChannelID, g.PostID, ghostOrbsEmoji, "@me")
|
||||||
g.EliminateGhosts(g.Evidence[len(g.Evidence)-1])
|
g.EliminateGhosts(g.Evidence[len(g.Evidence)-1])
|
||||||
for _, v := range g.PossibleEvidence {
|
for _, v := range g.PossibleEvidence {
|
||||||
switch v {
|
switch v {
|
||||||
case 0:
|
case 0:
|
||||||
go s.MessageReactionAdd(m.ChannelID, g.PostID, emf5Emoji)
|
s.MessageReactionAdd(m.ChannelID, g.PostID, emf5Emoji)
|
||||||
case 1:
|
case 1:
|
||||||
go s.MessageReactionAdd(m.ChannelID, g.PostID, freezingEmoji)
|
s.MessageReactionAdd(m.ChannelID, g.PostID, freezingEmoji)
|
||||||
case 2:
|
case 2:
|
||||||
go s.MessageReactionAdd(m.ChannelID, g.PostID, spiritBoxEmoji)
|
s.MessageReactionAdd(m.ChannelID, g.PostID, spiritBoxEmoji)
|
||||||
case 3:
|
case 3:
|
||||||
go s.MessageReactionAdd(m.ChannelID, g.PostID, ghostWritingEmoji)
|
s.MessageReactionAdd(m.ChannelID, g.PostID, ghostWritingEmoji)
|
||||||
case 4:
|
case 4:
|
||||||
go s.MessageReactionAdd(m.ChannelID, g.PostID, fingeyEmoji)
|
s.MessageReactionAdd(m.ChannelID, g.PostID, fingeyEmoji)
|
||||||
case 5:
|
case 5:
|
||||||
go s.MessageReactionAdd(m.ChannelID, g.PostID, ghostOrbsEmoji)
|
s.MessageReactionAdd(m.ChannelID, g.PostID, ghostOrbsEmoji)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(g.Evidence) == 3 {
|
if len(g.Evidence) == 3 {
|
||||||
@ -134,7 +134,9 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if _, ok := games[m.ChannelID]; !ok || strings.HasPrefix(m.Content, "!reset") {
|
if _, ok := games[m.ChannelID]; !ok || strings.HasPrefix(m.Content, "!reset") {
|
||||||
games[m.ChannelID] = Game{}
|
games[m.ChannelID] = Game{
|
||||||
|
Identifier: m.ChannelID,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
g := games[m.ChannelID]
|
g := games[m.ChannelID]
|
||||||
parts := strings.Split(m.Content, " ")
|
parts := strings.Split(m.Content, " ")
|
||||||
@ -192,60 +194,60 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
|
|||||||
}
|
}
|
||||||
if strings.HasPrefix(m.Content, "!c") {
|
if strings.HasPrefix(m.Content, "!c") {
|
||||||
if strings.Contains(m.Content, "emf") {
|
if strings.Contains(m.Content, "emf") {
|
||||||
g.CompleteObjective(EMF)
|
g.CompleteObjective(EMF, s)
|
||||||
}
|
}
|
||||||
if strings.Contains(m.Content, "photo") {
|
if strings.Contains(m.Content, "photo") {
|
||||||
g.CompleteObjective(Photo)
|
g.CompleteObjective(Photo, s)
|
||||||
}
|
}
|
||||||
if strings.Contains(m.Content, "event") {
|
if strings.Contains(m.Content, "event") {
|
||||||
g.CompleteObjective(Event)
|
g.CompleteObjective(Event, s)
|
||||||
}
|
}
|
||||||
if strings.Contains(m.Content, "crucifix") {
|
if strings.Contains(m.Content, "crucifix") {
|
||||||
g.CompleteObjective(Crucifix)
|
g.CompleteObjective(Crucifix, s)
|
||||||
}
|
}
|
||||||
if strings.Contains(m.Content, "motion") {
|
if strings.Contains(m.Content, "motion") {
|
||||||
g.CompleteObjective(Motion)
|
g.CompleteObjective(Motion, s)
|
||||||
}
|
}
|
||||||
if strings.Contains(m.Content, "clean") {
|
if strings.Contains(m.Content, "clean") {
|
||||||
g.CompleteObjective(SmudgeCleanse)
|
g.CompleteObjective(SmudgeCleanse, s)
|
||||||
}
|
}
|
||||||
if strings.Contains(m.Content, "hunt") {
|
if strings.Contains(m.Content, "hunt") {
|
||||||
g.CompleteObjective(SmudgeHunt)
|
g.CompleteObjective(SmudgeHunt, s)
|
||||||
}
|
}
|
||||||
if strings.Contains(m.Content, "salt") {
|
if strings.Contains(m.Content, "salt") {
|
||||||
g.CompleteObjective(Salt)
|
g.CompleteObjective(Salt, s)
|
||||||
}
|
}
|
||||||
if strings.Contains(m.Content, "candle") {
|
if strings.Contains(m.Content, "candle") {
|
||||||
g.CompleteObjective(Candle)
|
g.CompleteObjective(Candle, s)
|
||||||
}
|
}
|
||||||
if strings.Contains(m.Content, "sanity") {
|
if strings.Contains(m.Content, "sanity") {
|
||||||
g.CompleteObjective(LowSanity)
|
g.CompleteObjective(LowSanity, s)
|
||||||
}
|
}
|
||||||
if strings.Contains(m.Content, "escape") {
|
if strings.Contains(m.Content, "escape") {
|
||||||
g.CompleteObjective(MemberEscape)
|
g.CompleteObjective(MemberEscape, s)
|
||||||
}
|
}
|
||||||
if strings.Contains(m.Content, "death") {
|
if strings.Contains(m.Content, "death") {
|
||||||
g.CompleteObjective(NoDeaths)
|
g.CompleteObjective(NoDeaths, s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(g.Objective) == 3 && g.PostID == "" {
|
if len(g.Objective) == 3 && g.PostID == "" {
|
||||||
post, _ := s.ChannelMessageSend(m.ChannelID, "The investigation begins! Click below to log evidence.")
|
post, _ := s.ChannelMessageSend(m.ChannelID, "The investigation begins! Click below to log evidence.")
|
||||||
g.PossibleGhosts = append(g.PossibleGhosts, ghostTypes...)
|
g.PossibleGhosts = append(g.PossibleGhosts, ghostTypes...)
|
||||||
g.PostID = post.ID
|
g.PostID = post.ID
|
||||||
s.MessageReactionAdd(m.ChannelID, post.ID, fingeyEmoji)
|
go s.MessageReactionAdd(m.ChannelID, post.ID, fingeyEmoji)
|
||||||
s.MessageReactionAdd(m.ChannelID, post.ID, freezingEmoji)
|
go s.MessageReactionAdd(m.ChannelID, post.ID, freezingEmoji)
|
||||||
s.MessageReactionAdd(m.ChannelID, post.ID, spiritBoxEmoji)
|
go s.MessageReactionAdd(m.ChannelID, post.ID, spiritBoxEmoji)
|
||||||
s.MessageReactionAdd(m.ChannelID, post.ID, ghostWritingEmoji)
|
go s.MessageReactionAdd(m.ChannelID, post.ID, ghostWritingEmoji)
|
||||||
s.MessageReactionAdd(m.ChannelID, post.ID, emf5Emoji)
|
go s.MessageReactionAdd(m.ChannelID, post.ID, emf5Emoji)
|
||||||
s.MessageReactionAdd(m.ChannelID, post.ID, ghostOrbsEmoji)
|
go s.MessageReactionAdd(m.ChannelID, post.ID, ghostOrbsEmoji)
|
||||||
}
|
}
|
||||||
|
|
||||||
games[m.ChannelID] = g
|
games[m.ChannelID] = g
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Game) CompleteObjective(objective int) {
|
func (g *Game) CompleteObjective(objective int, s *discordgo.Session) {
|
||||||
var tasks []int
|
var tasks []int
|
||||||
ret := "Current objectives: ```"
|
ret := "Current objectives: ``` \n"
|
||||||
for _, v := range g.Objective {
|
for _, v := range g.Objective {
|
||||||
if v != objective {
|
if v != objective {
|
||||||
tasks = append(tasks, v)
|
tasks = append(tasks, v)
|
||||||
@ -253,8 +255,13 @@ func (g *Game) CompleteObjective(objective int) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ret += "```"
|
ret += "```"
|
||||||
msg, _ := dg.ChannelMessageSend(g.Identifier, ret)
|
msg, err := s.ChannelMessageSend(g.Identifier, ret)
|
||||||
dg.MessageReactionAdd(g.Identifier, msg.ID, deleteEmoji)
|
if err == nil {
|
||||||
|
s.MessageReactionAdd(g.Identifier, msg.ID, deleteEmoji)
|
||||||
|
} else {
|
||||||
|
fmt.Println(err)
|
||||||
|
fmt.Println(ret)
|
||||||
|
}
|
||||||
g.Objective = tasks
|
g.Objective = tasks
|
||||||
games[g.Identifier] = *g
|
games[g.Identifier] = *g
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user