Skip to content

Commit

Permalink
Cleanup: remove webhook_prefix (qaisjp#108)
Browse files Browse the repository at this point in the history
This setting is no longer needed as the bridge assumes it will be able
to manage webhooks and can do so automatically. Closes qaisjp#101.
  • Loading branch information
llmII authored Mar 6, 2021
1 parent 0426fb7 commit 33a4c60
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 13 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ The config file is a yaml formatted file with the following fields:
| `debug` | Yes | false | Yes | debug mode |
| `insecure`, | Yes | false | Yes | TLS will skip verification (but still uses TLS) |
| `no_tls`, | Yes | false | Yes | turns off TLS |
| `webhook_prefix`, | Yes | | No | a prefix for webhooks, so we know which ones to keep and which ones to delete |
| `nickserv_identify` | No | | Yes | on connect this message will be sent: `PRIVMSG nickserv IDENTIFY <value>`, you can provide both a username and password if your ircd supports it |
| `cooldown_duration` | No | 86400 (24 hours) | Yes | time in seconds for a discord user to be offline before it's puppet disconnects from irc |
| `show_joinquit` | No | false | yes | displays JOIN, PART, QUIT, KICK on discord |
Expand Down
7 changes: 0 additions & 7 deletions bridge/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ type Config struct {
// an IRC connection for each of the online Discord users.
SimpleMode bool

// WebhookPrefix is prefixed to each webhook created by the Discord bot.
WebhookPrefix string

Suffix string // Suffix is the suffix to append to IRC puppets
Separator string // Separator is used in IRC puppets' username, in fallback situations, between the discriminator and username.

Expand Down Expand Up @@ -108,10 +105,6 @@ func (b *Bridge) load(opts *Config) error {
return errors.New("missing server name")
}

if opts.WebhookPrefix == "" {
return errors.New("missing webhook prefix")
}

if err := b.SetChannelMappings(opts.ChannelMappings); err != nil {
return errors.Wrap(err, "channel mappings could not be set")
}
Expand Down
2 changes: 1 addition & 1 deletion bridge/discord.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func newDiscord(bridge *Bridge, botToken, guildID string) (*discordBot, error) {
}

func (d *discordBot) Open() error {
d.transmitter = transmitter.New(d.Session, d.guildID, d.bridge.Config.WebhookPrefix, true)
d.transmitter = transmitter.New(d.Session, d.guildID, "go-discord-irc", true)
d.transmitter.Log = logrus.NewEntry(logrus.StandardLogger())
if err := d.transmitter.RefreshGuildWebhooks(nil); err != nil {
return fmt.Errorf("failed to refresh guild webhooks: %w", err)
Expand Down
1 change: 0 additions & 1 deletion config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ max_nick_length: 30 # Maximum Length of a nick allowed
insecure: true
no_tls: false
debug: false
webhook_prefix: "(auto-test)"
# simple: true

# irc_listener_prejoin_commands:
Expand Down
3 changes: 0 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ func main() {
viper.SetDefault("separator", "~")
separator := viper.GetString("separator")
//
webhookPrefix := viper.GetString("webhook_prefix") // the unique prefix for this bottiful bot
//
viper.SetDefault("cooldown_duration", int64((time.Hour * 24).Seconds()))
cooldownDuration := viper.GetInt64("cooldown_duration")
//
Expand Down Expand Up @@ -164,7 +162,6 @@ func main() {
Separator: separator,
SimpleMode: *simple,
ChannelMappings: channelMappings,
WebhookPrefix: webhookPrefix,
CooldownDuration: time.Second * time.Duration(cooldownDuration),
ShowJoinQuit: showJoinQuit,
MaxNickLength: maxNickLength,
Expand Down

0 comments on commit 33a4c60

Please sign in to comment.