chat/message: Add UserConfig.Echo

This commit is contained in:
Andrey Petrov 2020-04-13 11:22:53 -04:00
parent c0f9814ae1
commit 2076980aea

View File

@ -161,6 +161,9 @@ func (u *User) render(m Message) string {
switch m := m.(type) { switch m := m.(type) {
case PublicMsg: case PublicMsg:
if u == m.From() { if u == m.From() {
if !cfg.Echo {
return ""
}
out += m.RenderSelf(cfg) out += m.RenderSelf(cfg)
} else { } else {
out += m.RenderFor(cfg) out += m.RenderFor(cfg)
@ -226,6 +229,7 @@ type UserConfig struct {
Highlight *regexp.Regexp Highlight *regexp.Regexp
Bell bool Bell bool
Quiet bool Quiet bool
Echo bool // Echo shows your own messages after sending, disabled for bots
Timeformat *string Timeformat *string
Timezone *time.Location Timezone *time.Location
Theme *Theme Theme *Theme
@ -237,6 +241,7 @@ var DefaultUserConfig UserConfig
func init() { func init() {
DefaultUserConfig = UserConfig{ DefaultUserConfig = UserConfig{
Bell: true, Bell: true,
Echo: true,
Quiet: false, Quiet: false,
} }