parent
bda8419b4b
commit
efe3388ac9
3 changed files with 26 additions and 7 deletions
|
|
@ -64,14 +64,14 @@ The configuration file allows you to configure and customize the behavior, keybi
|
|||
|
||||
```toml
|
||||
mouse = true
|
||||
hide_blocked_users = true
|
||||
messages_limit = 50
|
||||
editor = "default"
|
||||
|
||||
timestamps = false
|
||||
timestamps_before_author = false
|
||||
timestamps_format = "3:04PM"
|
||||
|
||||
messages_limit = 50
|
||||
editor = "default"
|
||||
|
||||
[keys]
|
||||
focus_guilds_tree = "Ctrl+G"
|
||||
focus_messages_text = "Ctrl+T"
|
||||
|
|
|
|||
|
|
@ -74,6 +74,22 @@ func (mt *MessagesText) reset() {
|
|||
}
|
||||
|
||||
func (mt *MessagesText) createMessage(m discord.Message) {
|
||||
if cfg.HideBlockedUsers {
|
||||
ready := discordState.Ready()
|
||||
var isBlocked bool
|
||||
for _, relationship := range ready.Relationships {
|
||||
if relationship.Type == discord.BlockedRelationship && relationship.UserID == m.Author.ID {
|
||||
isBlocked = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if isBlocked {
|
||||
fmt.Fprintln(mt, "[:red:b]Blocked message[:-:-]")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
switch m.Type {
|
||||
case discord.DefaultMessage, discord.InlinedReplyMessage:
|
||||
// Region tags are square brackets that contain a region ID in double quotes
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ import (
|
|||
|
||||
type Config struct {
|
||||
Mouse bool `toml:"mouse"`
|
||||
HideBlockedUsers bool `toml:"hide_blocked_users"`
|
||||
|
||||
MessagesLimit uint8 `toml:"messages_limit"`
|
||||
Editor string `toml:"editor"`
|
||||
|
||||
|
|
@ -25,6 +27,7 @@ type Config struct {
|
|||
func defaultConfig() *Config {
|
||||
return &Config{
|
||||
Mouse: true,
|
||||
HideBlockedUsers: true,
|
||||
MessagesLimit: 50,
|
||||
Editor: "default",
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue