feat(discord): add configuration support for Discord channel proxy settings
- Introduced a config field in the DiscordChannel struct to manage proxy settings. - Updated the downloadAttachment method to utilize the new configuration for proxy URLs.
This commit is contained in:
parent
09e3aacf88
commit
5a5a7734fd
1 changed files with 3 additions and 1 deletions
|
|
@ -29,6 +29,7 @@ const (
|
||||||
type DiscordChannel struct {
|
type DiscordChannel struct {
|
||||||
*channels.BaseChannel
|
*channels.BaseChannel
|
||||||
session *discordgo.Session
|
session *discordgo.Session
|
||||||
|
config *config.Config
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
cancel context.CancelFunc
|
cancel context.CancelFunc
|
||||||
typingMu sync.Mutex
|
typingMu sync.Mutex
|
||||||
|
|
@ -57,6 +58,7 @@ func NewDiscordChannel(cfg *config.Config, bus *bus.MessageBus) (*DiscordChannel
|
||||||
return &DiscordChannel{
|
return &DiscordChannel{
|
||||||
BaseChannel: base,
|
BaseChannel: base,
|
||||||
session: session,
|
session: session,
|
||||||
|
config: cfg,
|
||||||
ctx: context.Background(),
|
ctx: context.Background(),
|
||||||
typingStop: make(map[string]chan struct{}),
|
typingStop: make(map[string]chan struct{}),
|
||||||
commands: commands,
|
commands: commands,
|
||||||
|
|
@ -492,7 +494,7 @@ func (c *DiscordChannel) StartTyping(ctx context.Context, chatID string) (func()
|
||||||
func (c *DiscordChannel) downloadAttachment(url, filename string) string {
|
func (c *DiscordChannel) downloadAttachment(url, filename string) string {
|
||||||
return utils.DownloadFile(url, filename, utils.DownloadOptions{
|
return utils.DownloadFile(url, filename, utils.DownloadOptions{
|
||||||
LoggerPrefix: "discord",
|
LoggerPrefix: "discord",
|
||||||
ProxyURL: c.config.Proxy,
|
ProxyURL: c.config.Channels.Discord.Proxy,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue