mirror of
https://github.com/tiennm99/tiennm99bot.git
synced 2026-10-11 03:13:46 +00:00
feat(blacklist): add /blacklist shorthand and /whitelist_rnd
/blacklist is the short form of the two read commands: bare it lists both lists like /blacklist_rules, and given text it judges that text like /blacklist_check. Both long names stay for when the intent should be explicit. An argument of only whitespace is not an argument, so it lists. /whitelist_rnd returns one whitelist entry chosen at random, and says the list is empty rather than answering with nothing. It reads only the whitelist, and only for the calling topic. The six existing command descriptions are shortened alongside. /help renders as one un-chunked message pinned at 4096 runes, and two more commands pushed it to 4123; the shorter wording brings it to 4049. That ceiling is a shared limit this module did not create, and it will bind again on the next command added anywhere in the repo.
This commit is contained in:
1 parent
c47bcf2c7f
commit
53e569ca12
6 files changed
+194
-13
No files matched your search
@@ -75,12 +75,14 @@ func TestCommandDiscovery_AllPublicCommandsHaveSafeMetadata(t *testing.T) {
|
||||
"addsticker": "[emoji...]",
|
||||
"alias": "<name>",
|
||||
"aliases": "",
|
||||
"blacklist": "[text...]",
|
||||
"blacklist_add": "[text...]",
|
||||
"blacklist_del": "<text...>",
|
||||
"blacklist_rules": "",
|
||||
"blacklist_check": "<text...>",
|
||||
"whitelist_add": "[text...]",
|
||||
"whitelist_del": "<text...>",
|
||||
"whitelist_rnd": "",
|
||||
"unalias": "<name>",
|
||||
"insert": "<name>",
|
||||
"stats": "[users | user <username> | cmd <command_name>]",
|
||||
|
||||
@@ -139,15 +139,15 @@ func TestFactoriesRegistersBlacklistCommands(t *testing.T) {
|
||||
t.Fatalf("Build blacklist: %v", err)
|
||||
}
|
||||
for _, name := range []string{
|
||||
"blacklist_add", "blacklist_del", "blacklist_rules", "blacklist_check",
|
||||
"whitelist_add", "whitelist_del",
|
||||
"blacklist", "blacklist_add", "blacklist_del", "blacklist_rules",
|
||||
"blacklist_check", "whitelist_add", "whitelist_del", "whitelist_rnd",
|
||||
} {
|
||||
if _, ok := reg.AllCommands[name]; !ok {
|
||||
t.Fatalf("missing command %s", name)
|
||||
}
|
||||
}
|
||||
if got := len(reg.AllCommands); got != 6 {
|
||||
t.Fatalf("blacklist registered %d commands, want 6", got)
|
||||
if got := len(reg.AllCommands); got != 8 {
|
||||
t.Fatalf("blacklist registered %d commands, want 8", got)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user