-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
534 additions
and
459 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package main | ||
|
||
import ( | ||
"strings" | ||
|
||
"github.com/bwmarrin/discordgo" | ||
|
||
"github.com/nint8835/scribe/database" | ||
) | ||
|
||
type AddArgs struct { | ||
Text string `description:"Text for the quote to add. To insert a new line, insert \\n."` | ||
Author discordgo.User `description:"Author of the quote."` | ||
Source *string `description:"Link to a source for the quote, if available (such as a Discord message, screenshot, etc.)"` | ||
} | ||
|
||
func AddQuoteCommand(_ *discordgo.Session, interaction *discordgo.InteractionCreate, args AddArgs) { | ||
quote := database.Quote{ | ||
Text: strings.Replace(args.Text, "\\n", "\n", -1), | ||
Authors: []*database.Author{{ID: args.Author.ID}}, | ||
Source: args.Source, | ||
} | ||
|
||
addQuote(quote, interaction) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/bwmarrin/discordgo" | ||
|
||
"github.com/nint8835/scribe/database" | ||
) | ||
|
||
func AddQuoteMessageCommand(_ *discordgo.Session, interaction *discordgo.InteractionCreate, message *discordgo.Message) { | ||
if message.Content == "" { | ||
Bot.InteractionRespond(interaction.Interaction, &discordgo.InteractionResponse{ | ||
Type: discordgo.InteractionResponseChannelMessageWithSource, | ||
Data: &discordgo.InteractionResponseData{ | ||
Embeds: []*discordgo.MessageEmbed{ | ||
{ | ||
Color: (240 << 16) + (85 << 8) + (125), | ||
Title: "Error adding quote.", | ||
Description: "You cannot quote an empty message.", | ||
}, | ||
}, | ||
Flags: discordgo.MessageFlagsEphemeral, | ||
}, | ||
}) | ||
return | ||
} | ||
|
||
quoteUrl := fmt.Sprintf("https://discord.com/channels/%s/%s/%s", message.GuildID, message.ChannelID, message.ID) | ||
|
||
quote := database.Quote{ | ||
Text: message.Content, | ||
Authors: []*database.Author{{ID: message.Author.ID}}, | ||
Source: "eUrl, | ||
} | ||
|
||
addQuote(quote, interaction) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.