discord

package
v0.8.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

oauth.go

discordmessages.go

discordchannels.go

discordguilds.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ScrapeDiscordMessagesForSentiment

func ScrapeDiscordMessagesForSentiment(channelID string, model string, prompt string) (string, string, error)

ScrapeDiscordMessagesForSentiment scrapes messages from a Discord channel and analyzes their sentiment.

Types

type BotConfig

type BotConfig struct {
	Token string
}

BotConfig holds the configuration details for the Discord bot

func LoadConfig

func LoadConfig() *BotConfig

LoadConfig reads configuration from environment variables or a .env file

type ChannelMessage

type ChannelMessage struct {
	ID        string `json:"id"`
	ChannelID string `json:"channel_id"`
	Author    struct {
		ID            string `json:"id"`
		Username      string `json:"username"`
		Discriminator string `json:"discriminator"`
		Avatar        string `json:"avatar"`
	} `json:"author"`
	Content   string `json:"content"`
	Timestamp string `json:"timestamp"`
}

ChannelMessage represents a Discord channel message structure

func GetChannelMessages

func GetChannelMessages(channelID string, limit string, before string) ([]ChannelMessage, error)

GetChannelMessages fetches messages for a specific channel from the Discord API

type Guild

type Guild struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Icon        string `json:"icon"`
	Owner       bool   `json:"owner"`
	Permissions int64  `json:"permissions"`
}

Guild represents a Discord guild (server) structure

func GetUserGuilds

func GetUserGuilds() ([]Guild, error)

GetUserGuilds fetches the guilds (servers) that the current user is part of

type GuildChannel

type GuildChannel struct {
	ID      string `json:"id"`
	GuildID string `json:"guild_id"`
	Name    string `json:"name"`
	Type    int    `json:"type"`
}

GuildChannel represents a Discord guild channel structure

func GetGuildChannels

func GetGuildChannels(guildID string) ([]GuildChannel, error)

GetGuildChannels fetches the channels for a specific guild from the Discord API

type OAuthTokenResponse

type OAuthTokenResponse struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    int    `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
	Scope        string `json:"scope"`
}

OAuthTokenResponse holds the structure for an OAuth token response

func ExchangeCode

func ExchangeCode(code string) (*OAuthTokenResponse, error)

ExchangeCode exchanges an OAuth2 authorization code for an access token

type UserProfile

type UserProfile struct {
	ID            string `json:"id"`
	Username      string `json:"username"`
	Discriminator string `json:"discriminator"`
	Avatar        string `json:"avatar"`
}

UserProfile holds the structure for a Discord user profile response

func GetUserProfile

func GetUserProfile(userID string) (*UserProfile, error)

GetUserProfile fetches a user's profile from Discord API

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL