Skip to content

Commit

Permalink
feat(core): start sending notices of deprecation of emoji functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
tyzbit committed Jul 21, 2024
1 parent c700908 commit dc9d81d
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 18 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ https://discord.gg/kvE2bbfYu3

Set some environment variables before launching, or add a `.env` file.

If database environment variables are provided, the bot will save stats to an external database.
Otherwise, it will save stats to a local sqlite database at `/var/go-discord-archiver/local.db`
If database environment variables are provided, the bot will save configuration to an external database.
Otherwise, it will save configuration to a local sqlite database at `/var/go-discord-archiver/local.db`

| Variable | Value(s) |
| :---------------- | :------------------------------------------------------------------------------------- |
Expand Down
22 changes: 19 additions & 3 deletions bot/discord_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,21 @@ func (bot *ArchiverBot) MessageReactionAddHandler(s *discordgo.Session, r *disco
log.Errorf("problem sending message: %v", err)
}
}

bot.DG.ChannelMessageSendComplex(r.ChannelID, &discordgo.MessageSend{
Embeds: []*discordgo.MessageEmbed{{
Title: "NOTICE!!!!",
Color: globals.BrightRed,
Description: "The emoji reaction feature is being removed on " +
"September 1, 2024 due to llimitations Discord has " +
"imposed. Instead, use the context menus (right-click or " +
"long press a message). They offer more functionality " +
"than the emoji as well. You can also use the `/archive` " +
"command. Use `/help` for more info. You can provide " +
"feedback on this change on the [issue tracker]" +
"(https://github.com/tyzbit/go-discord-archiver/issues/38).",
}},
})
}
}

Expand Down Expand Up @@ -188,8 +203,9 @@ func (bot *ArchiverBot) InteractionHandler(s *discordgo.Session, i *discordgo.In
}
},
// bot.archiveInteraction can handle both the archive slash command and the app menu function
globals.Archive: func(s *discordgo.Session, i *discordgo.InteractionCreate) { bot.archiveInteraction(i, false, true) },
globals.ArchiveMessage: func(s *discordgo.Session, i *discordgo.InteractionCreate) { bot.archiveInteraction(i, false, true) },
globals.Archive: func(s *discordgo.Session, i *discordgo.InteractionCreate) { bot.archiveInteraction(i, false, false) },
globals.ArchiveMessage: func(s *discordgo.Session, i *discordgo.InteractionCreate) { bot.archiveInteraction(i, false, false) },
globals.ArchiveMessagePrivate: func(s *discordgo.Session, i *discordgo.InteractionCreate) { bot.archiveInteraction(i, false, true) },
globals.ArchiveMessageNewSnapshot: func(s *discordgo.Session, i *discordgo.InteractionCreate) { bot.archiveInteraction(i, true, true) },
globals.Settings: func(s *discordgo.Session, i *discordgo.InteractionCreate) {
log.Debug("handling settings request")
Expand Down Expand Up @@ -348,7 +364,7 @@ func (bot *ArchiverBot) InteractionHandler(s *discordgo.Session, i *discordgo.In
}
}

// archiveInteraction is called by using /archive and using the "Get snapshots" app function.
// archiveInteraction is called by using /archive and using the "Get archived snapshots" app function.
func (bot *ArchiverBot) archiveInteraction(i *discordgo.InteractionCreate, newSnapshot bool, ephemeral bool) {
log.Debug("handling archive command request")
var flags discordgo.MessageFlags
Expand Down
4 changes: 3 additions & 1 deletion bot/responses.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,9 @@ func (bot *ArchiverBot) buildArchiveReply(archivedLinks []string, messageUrls []
}
}
embed.Footer = &discordgo.MessageEmbedFooter{
Text: "⚙️ Customize this message with /settings",
Text: "⚙️ Customize this message with /settings\n" +
"NOTICE: Reacting with 🏛️ being deprecated September 1, 2024," +
" run `/help` for more.",
}

embed.URL = originalUrl
Expand Down
21 changes: 10 additions & 11 deletions globals/globals.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ const (
Retry = "retry"

// Commands
Stats = "stats"
Settings = "settings"
Archive = "archive"
ArchiveMessage = "Get snapshot"
ArchiveMessagePrivate = "Get snapshot (private)"
ArchiveMessageNewSnapshot = "Take snapshot"
ArchiveMessage = "Get saved snapshots"
ArchiveMessagePrivate = "Get saved snapshots (private)"
ArchiveMessageNewSnapshot = "Take new snapshot"
Help = "help"

// Command options
Expand All @@ -36,15 +35,19 @@ const (

// Colors
FrenchGray = 13424349
BrightRed = 16711680

// Archive.org URL timestamp layout
ArchiveOrgTimestampLayout = "20060102150405"

// Shown to the user when `/help` is called
BotHelpText = `**Usage**
React to a message that has links with 🏛 (The "classical building" emoji) and the bot will respond in the channel with an archive.org link for the link(s). It saves the page to archive.org if needed.
- You can also right-click (or long press) a message and use "Get snapshot" to get a message with snapshots that only you can see- You can also right-click (or long press) a message and use "Get snapshot" to get a message with snapshots that only you can see or select "Take snapshot" to take a snapshot of the live page.
- Right-click (or long press) a message and use "Get snapshot" to post a message with snapshots for the links in the message.
- Use the private option for a message only you can see.
- Select "Take snapshot" to take a new snapshot of the live page.
⚠️ Being deprecated Dec 1, 2024⚠️
- React to a message that has links with 🏛 (The "classical building" emoji) and the bot will respond in the channel with an archive.org link for the link(s). It saves the page to archive.org if needed.
**This is a pretty good way to get around paywalls to read articles for free.**
Expand Down Expand Up @@ -117,10 +120,6 @@ var (
Name: ArchiveMessageNewSnapshot,
Type: discordgo.MessageApplicationCommand,
},
{
Name: Stats,
Description: "Show bot stats",
},
{
Name: Settings,
Description: "Change settings",
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func main() {
// We have to be explicit about what we want to receive. In addition,
// some intents require additional permissions, which must be granted
// to the bot when it's added or after the fact by a guild admin
discordIntents := discordgo.IntentsGuildMessages | discordgo.IntentsGuilds |
discordIntents := discordgo.IntentsGuilds |
discordgo.IntentsDirectMessages | discordgo.IntentsDirectMessageReactions |
discordgo.IntentsGuildMessageReactions
dg.Identify.Intents = discordIntents
Expand Down

0 comments on commit dc9d81d

Please sign in to comment.