fix: issues
This commit is contained in:
@@ -17,6 +17,9 @@ type ChannelConfig struct {
|
||||
}
|
||||
|
||||
func NewChannelConfig(channelID int64) *ChannelConfig {
|
||||
if channelID == 0 {
|
||||
panic("channel id is required")
|
||||
}
|
||||
return &ChannelConfig{ID: channelID}
|
||||
}
|
||||
|
||||
@@ -53,7 +56,7 @@ func (c *ChannelConfig) file(_ context.Context) (string, error) {
|
||||
// if file not exists then create it
|
||||
if _, err := os.Stat(channelConfigFile); os.IsNotExist(err) {
|
||||
// create config file
|
||||
data, _ := json.Marshal(&ChannelConfig{ID: channelID})
|
||||
data, _ := json.Marshal(c)
|
||||
if err := os.WriteFile(channelConfigFile, data, 0o644); err != nil {
|
||||
return "", errors.Wrap(err, "write channel config")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user