Skip to content

Commit

Permalink
fix: finishing debugging session
Browse files Browse the repository at this point in the history
dd84ai committed Jul 29, 2024
1 parent ffed293 commit cc40727
Showing 4 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"

env:
tag_version: v1.6.7
tag_version: v1.6.10
DOCKER_HOST: ssh://root@darklab:22

tasks:
1 change: 0 additions & 1 deletion app/discorder/main.go
Original file line number Diff line number Diff line change
@@ -31,7 +31,6 @@ func NewClient() *Discorder {
d := &Discorder{}
dg, err := discordgo.New("Bot " + settings.Env.DiscorderBotToken)
logus.Log.CheckFatal(err, "failed to init discord")
dg.Identify.Intents = discordgo.IntentsGuildMessages

d.dg = dg
return d
19 changes: 18 additions & 1 deletion app/forumer/run.go
Original file line number Diff line number Diff line change
@@ -224,12 +224,29 @@ func (v *Forumer) TrySendMsg(channel types.DiscordChannelID, new_post *forum_typ

purple_color := 10181046
embed.Color = purple_color

_, err := dg.ChannelMessageSendComplex(string(channel), &discordgo.MessageSend{Embeds: []*discordgo.MessageEmbed{embed}, Content: fmt.Sprintf("mail for %s", string(pingMessage))})

// helpful to uncover problems with Embeds sending.
// There was issue with insufficient granted permission to bot once. Inviting bot as admin helped to fix the issue.
// _, err := dg.ChannelMessageSendEmbed(string(channel), embed)

// if u will wish simpler msg
// var normal_msg strings.Builder
// normal_msg.WriteString(fmt.Sprintf("%s\n", string(pingMessage)))
// normal_msg.WriteString(fmt.Sprintf("[%s](%s)\n", string(new_post.ThreadFullName), string(new_post.PostPermamentLink)))
// normal_msg.WriteString(content.String())
// normal_msg.WriteString(fmt.Sprintln("**Matched tags**: `", strings.Join(matched_tags, ", "), "`"))
// normal_msg.WriteString(fmt.Sprintln("**Timestamp**: `", string(new_post.LastUpdated), "`"))
// normal_msg.WriteString(fmt.Sprintln("**Subforums**: `", strings.Join(subforums, " / "), "`"))
// _, err := dg.ChannelMessageSend(string(channel), normal_msg.String())

logus.Log.Debug("sent forumer msg",
logus.MsgContent(post_content),
logus.ChannelID(channel),
)
logus.Log.CheckError(err, "failed sending msg")
logus.Log.CheckError(err, "failed sending msg", logus.ChannelID(channel))

return nil
})
}
4 changes: 2 additions & 2 deletions tf/production/main.tf
Original file line number Diff line number Diff line change
@@ -25,8 +25,8 @@ module "darkbot" {
configurator_dbname = "production"
consoler_prefix = "."
secrets = local.secrets
tag_version = "v1.6.7"
tag_version = "v1.6.10"
mode = "docker"
environment = "production"
debug = true
debug = false
}

0 comments on commit cc40727

Please sign in to comment.