@@ -257,7 +257,7 @@ func (b *Bot) OnSubredditAdd(data discord.SlashCommandInteractionData, event *ev
257
257
}
258
258
259
259
if _ , err = b .Client .Rest ().CreateWebhookMessage (webhook .ID (), webhook .Token , discord.WebhookMessageCreate {
260
- Content : fmt .Sprintf ("Added subscription for %s" , formatSubreddit (subreddit )),
260
+ Content : fmt .Sprintf ("Added subscription for %s" , formatSubreddit (subreddit , false )),
261
261
}, true , 0 ); err != nil {
262
262
_ = event .CreateMessage (discord.MessageCreate {
263
263
Content : "Failed to send test message to webhook: " + err .Error (),
@@ -284,7 +284,7 @@ func (b *Bot) OnSubredditAdd(data discord.SlashCommandInteractionData, event *ev
284
284
}
285
285
286
286
_ = event .CreateMessage (discord.MessageCreate {
287
- Content : fmt .Sprintf ("Subscribed to %s)" , formatSubreddit (subreddit )),
287
+ Content : fmt .Sprintf ("Subscribed to %s)" , formatSubreddit (subreddit , false )),
288
288
})
289
289
}
290
290
@@ -337,7 +337,7 @@ func (b *Bot) OnSubredditUpdate(data discord.SlashCommandInteractionData, event
337
337
}
338
338
339
339
_ = event .CreateMessage (discord.MessageCreate {
340
- Content : fmt .Sprintf ("Updated subscription for %s" , formatSubreddit (subreddit )),
340
+ Content : fmt .Sprintf ("Updated subscription for %s" , formatSubreddit (subreddit , false )),
341
341
Flags : discord .MessageFlagEphemeral ,
342
342
})
343
343
}
@@ -396,7 +396,11 @@ func (b *Bot) OnSubredditList(data discord.SlashCommandInteractionData, event *e
396
396
if sub .RedditProxy != "" {
397
397
proxy = fmt .Sprintf ("`%s`" , sub .RedditProxy )
398
398
}
399
- content += fmt .Sprintf ("- `%s` - `%s` - %s - %s- %s\n " , strings .Title (sub .Type ), strings .Title (string (sub .FormatType )), role , proxy , formatSubreddit (sub .Subreddit ))
399
+ linkButton := "enabled"
400
+ if ! sub .LinkButton {
401
+ linkButton = "disabled"
402
+ }
403
+ content += fmt .Sprintf ("- %s - type: `%s` - format: `%s` - role: %s - proxy: %s - link-button: `%s`\n " , formatSubreddit (sub .Subreddit , true ), strings .Title (sub .Type ), strings .Title (string (sub .FormatType )), role , proxy , linkButton )
400
404
}
401
405
402
406
_ = event .CreateMessage (discord.MessageCreate {
@@ -469,7 +473,7 @@ func (b *Bot) OnDiscordCallback(w http.ResponseWriter, r *http.Request) {
469
473
}
470
474
471
475
if _ , err = b .Client .Rest ().CreateWebhookMessage (webhookID , webhookToken , discord.WebhookMessageCreate {
472
- Content : fmt .Sprintf ("Added subscription for %s" , formatSubreddit (setupState .Subreddit )),
476
+ Content : fmt .Sprintf ("Added subscription for %s" , formatSubreddit (setupState .Subreddit , false )),
473
477
}, true , 0 ); err != nil {
474
478
_ , _ = b .Client .Rest ().UpdateInteractionResponse (setupState .Interaction .ApplicationID (), setupState .Interaction .Token (), discord.MessageUpdate {
475
479
Content : json .Ptr ("Failed to send test message to webhook: " + err .Error ()),
@@ -480,12 +484,15 @@ func (b *Bot) OnDiscordCallback(w http.ResponseWriter, r *http.Request) {
480
484
481
485
delete (b .states , state )
482
486
_ , _ = b .Client .Rest ().UpdateInteractionResponse (setupState .Interaction .ApplicationID (), setupState .Interaction .Token (), discord.MessageUpdate {
483
- Content : json .Ptr (fmt .Sprintf ("Subscribed to %s)" , formatSubreddit (setupState .Subreddit ))),
487
+ Content : json .Ptr (fmt .Sprintf ("Subscribed to %s)" , formatSubreddit (setupState .Subreddit , false ))),
484
488
Components : & []discord.ContainerComponent {},
485
489
})
486
490
_ , _ = w .Write ([]byte ("success, you can close this window now" ))
487
491
}
488
492
489
- func formatSubreddit (subreddit string ) string {
493
+ func formatSubreddit (subreddit string , suppressEmbed bool ) string {
494
+ if suppressEmbed {
495
+ return fmt .Sprintf ("[`r/%s`](<https://reddit.com/r/%s>)" , subreddit , subreddit )
496
+ }
490
497
return fmt .Sprintf ("[`r/%s`](https://reddit.com/r/%s)" , subreddit , subreddit )
491
498
}
0 commit comments