refactor: use plugins to combine multiple functions #1

Merged
trle5 merged 250 commits from alpha into main 2025-11-05 23:05:51 +08:00

250 Commits

Author SHA1 Message Date
2ddd7d35cd add lock for gif download 2025-11-01 21:59:01 +08:00
60396b6cd9 add limits (120) to stickers in sticker packs
Disable the download function for sticker packs containing more than 120 stickers.
2025-11-01 20:20:19 +08:00
b53856fdbc read sticker in zip when download single sticker
sticker:
    delay zip file close function
internal:
    remove inline prefix handler `log`
    add slash command `log`
    add inline prefix handler `gc`
version:
    add `github.com/dustin/go-humanize` for memory
2025-10-16 21:55:46 +08:00
e7125dc62e sticker collect, detect keyword and error
error:
    use `utils.IgnoreHTMLTags()` warp some error
collect sticker:
    show sticker count update
detect keyword:
    make sure notice message not too long
2025-10-14 00:25:14 +08:00
8f9fef7063 hash cached sticker set
check compressed file before iterating over sticker set
2025-10-13 23:56:26 +08:00
504bf1c423 move sticker download lock to handler
send notice when user need to wait in queue
add chat action when downloading
2025-10-13 22:06:28 +08:00
c2c7034b05 remove origin info button for user saved
sticker:
    add missing error return
2025-10-09 20:22:09 +08:00
2082aba0a5 sticker set download and mutex lock
main:
    remove multiple worker
sticker:
    add download mutex lock
    add link for sticker set that exceed the size limit
2025-10-09 17:13:07 +08:00
8eaf57f983 fix notice when download or collect sticker set 2025-09-30 21:42:17 +08:00
8cfb5d2954 add close notice and context case 2025-09-30 21:09:04 +08:00
426534ef08 single instance 2025-09-30 20:59:50 +08:00
6a00e464d8 Update plugin_teamspeak3.go 2025-09-25 20:23:10 +08:00
ee69a5e98e fix .tgs sticker async download bug 2025-09-24 13:09:26 +08:00
d8858b0210 add start time 2025-09-24 00:23:10 +08:00
f4057c7e9d edit message when collect stickerset using a link 2025-09-18 16:04:52 +08:00
7efb47165e add connecting log 2025-09-15 20:43:54 +08:00
5d17bb8447 add admin check 2025-09-14 20:03:33 +08:00
1e8744895f add edit message entities button 2025-09-14 10:27:02 +08:00
d78e771625 remove source button 2025-09-14 09:19:09 +08:00
40f5cf1900 show a tips when download stickerset using a link 2025-09-13 19:44:43 +08:00
a79a57611f add media group link 2025-09-13 16:44:07 +08:00
8fc7c7d61f fix reconnected notice
stop use timeout context after success reconnect
2025-09-11 21:37:32 +08:00
85ff55f81c fix unexpected convert action 2025-09-09 21:51:59 +08:00
a585bd915f fix sticker link panic 2025-09-09 21:19:21 +08:00
a32ebc2cf0 add collect sticker user check 2025-09-09 21:06:34 +08:00
62cc4b320e refactor sticker download
config:
    remove `FFmpegPath` field
sticker:
    make sticker plugin as a package
    add [gifski](https://github.com/ImageOptim/gifski/) and [lottie-converter](https://github.com/ed-asriyan/lottie-converter) to convert `.tgs` to `.gif`
    refactor download, convert and compress logics
    add sticker config file
2025-09-09 16:41:56 +08:00
05db52679f use Message.Chat.ID to delete or save state handler 2025-09-04 13:33:43 +08:00
f3324ca521 add sync.RWMutex in yaml database
signals:
    also save plugin database when exit
2025-09-04 12:59:19 +08:00
d8555343d2 add limiter for callback query
detect_keyword:
    fix remove by message chat ID handler
2025-09-03 22:29:11 +08:00
a09d6e40df separate user and channel saved message
edit sticker download callback data prefix
2025-09-01 09:01:24 +08:00
0ea6f47435 only use file ID as cached sticker file name 2025-09-01 06:59:23 +08:00
e7f568923c disable user saved message 2025-09-01 02:36:41 +08:00
fca897a001 allow record channel usage 2025-08-31 02:31:36 +08:00
15aad62cc8 add channel post log
remove same callback query notice
2025-08-31 01:31:18 +08:00
6151632361 fix reconnect loophole 2025-08-30 23:55:16 +08:00
a84d22e7e2 add DeleteOldPinnedMessage flag
update help text for plugins
2025-08-28 08:20:32 +08:00
4878f9a545 refactor teamspeak initialization logic
try using multiple workers?
2025-08-28 07:00:52 +08:00
f1a106c6e8 add bot instance when register plugins
slash start command:
    fix notes
    remove prefix argument underline suffix check
2025-08-28 05:53:28 +08:00
03b72b9106 refactor slash start handler 2025-08-26 14:11:46 +08:00
2cb684aba5 add view channel link command 2025-08-26 06:17:29 +08:00
01a9c3d5a5 remove mixed result lists 2025-08-24 21:55:27 +08:00
b0c27d5a81 use utf16 to count text length 2025-08-21 02:44:37 +08:00
f8af0d8711 Update Makefile 2025-08-21 02:23:08 +08:00
4fa9673c29 add logger time format
teamspeak3:
    add re-init timeout
2025-08-21 02:17:49 +08:00
7238c8f890 refactor bot init function
database:
    move default database directory to `data/`
environment:
    add `WEBHOOL_ADDR`
    add `LOG_CHAT_ID`
    add `LOG_FILE_PATH`
    rename `CONFIG_PATH_TO_FILE` to `CONFIG_PATH`
    rename `CONFIG_DIRECTORY` to `CONFIG_DIR`
2025-08-21 00:47:58 +08:00
4fc0131dfd refactor: merge consts into configs package 2025-08-20 05:24:21 +08:00
360d19bfd0 add makefile windows support 2025-08-19 08:11:29 +08:00
ce6b600ee6 add user and bot default handler notice 2025-08-19 05:45:14 +08:00
41609f3b04 update go-telegram/bot to v1.17.0
set `bot.WithErrorsHandler()` option to output log via `zerolog`
2025-08-19 05:09:14 +08:00
8986bf8f48 add GetCurrentFuncName() func to show function name 2025-08-18 05:21:21 +08:00
c8436e3cb6 fix inline mode can't show sub-command 2025-08-18 05:09:12 +08:00
6906ec5e7f catch pagination symbol in saved_message
saved_message:
    fix no `InlineQueryResultsButton` error
    add result list check
    stop fetch public content when result list reaches "configs.BotConfig.InlineResultsPerPage" limit
    remove result pagination step
    fix wrong HTML tag
plugin_teamspeak3:
    remove `expandable` attribute in pinned online user list
2025-08-18 03:53:25 +08:00
ed4268f3de add saved message notice
saved_message:
    add `NoticeChatID` field to receive notice
    default use first admin as notice chat
utils:
    add `MsgLink` and `MsgLinkPrivate` function
origin_info:
    use `tg://user?id=<userID>` to link to a user
2025-08-18 03:09:55 +08:00
355a372f47 add collect sticker button for sticker set link
origin_info:
    add json tag for `OriginInfo` struct
2025-08-17 02:06:09 +08:00
e2c2645e29 refactor plugin_message_meilisearch
plugin_message_meilisearch:
    become a sub-package of `saved_message`
meilisearch_utils:
    rename `MsgID` to `ID`
    rename `MsgType` to `Type`
saved_message:
    add search category map list
2025-08-17 01:42:50 +08:00
092cf03fa8 fix wrong link uri 2025-08-15 05:19:15 +08:00
2b02eb436b add missing changes 2025-08-15 05:08:30 +08:00
eac60d0787 use another category method
message_type:
    rename `OnlyText` to `Text`
2025-08-15 05:04:47 +08:00
d71f285ace allow edit description
handlers.go:
    add inline no command notice
saved_message:
    allow edit description
meilisearch_utils:
    add `omitempty` tag in MessageData struct
2025-08-15 02:46:10 +08:00
054061f77d update collect sticker text 2025-08-14 00:31:15 +08:00
c8e0629b93 add collected sticker check
saved_message:
    fix nil user panic
2025-08-13 23:04:19 +08:00
de0acebd45 fix save self origin info 2025-08-12 00:31:36 +08:00
977cb80831 fix cant remove by message chat id handler 2025-08-12 00:22:13 +08:00
318a227f66 remove voicelist plugin 2025-08-12 00:17:56 +08:00
56a542be31 fix save message panic 2025-08-11 23:42:28 +08:00
70b71b459d save OriginInfo in channel mode 2025-08-11 23:22:49 +08:00
7a1e0ff05c fix save item in channel mode 2025-08-11 23:06:54 +08:00
f3226e6cf4 refactor saved_message use meiliserach
spilt `origin_info` as a package
disable `plugin_message_meilisearch`
2025-08-11 22:52:41 +08:00
bd4b850a6d add meilisearch
plugin_message_meilisearch:
    allow index message
    allow search mesage use command or inline mode
saved_message:
    test channel mode
    stop add more entities
    change main data list sturcts
utils:
    add `meilisearch_utils` package
handler_state:
    rename `StateHandler` to `MessageStateHandler`
register:
    add some field for `/chatinfo` command
inline_utils:
    add a `KeywordQuery()` method
2025-08-10 02:44:42 +08:00
c253ef45c4 refactor handler by chat ID
plugin_utils:
    origin `handler_by_chatid` is fork as `handler_by_message_chat_id`
    rename `AddInlineHandlerHandlers` to `AddInlineHandlers`
2025-08-09 20:12:31 +08:00
ba730dc056 revert parse mode changes
plugin_detect_keyword.go:
    keep use HTML parse mode
    fix init user bug
utils.go:
    add `GetChatIDLink()` and `IgnoreHTMLTags()` function
2025-08-05 01:37:08 +08:00
13a6b46911 fix state handler trigger
handler_state.go:
    use chat ID to get handler
utils.go:
     `GetMessageFromHyperLink()` fix format
    add `TextBlockquoteMarkdown()` function
plugin_detect_keyword.go:
    stop convert text to lowercase
    use `contain.SubStringCaseInsensitive()` replace `strings.Contains()`
    use `models.ParseModeMarkdown` in `notifyUser()`
2025-08-05 00:26:56 +08:00
4dc101f57c fix manager keyboard and init panic 2025-08-04 23:31:19 +08:00
6cfc8ffd58 rename logger 2025-08-02 22:14:50 +08:00
586c204096 rename struct and method 2025-08-02 04:17:57 +08:00
ea2a4a0032 fix init channel panic 2025-07-30 01:42:25 +08:00
beebc923e7 detect keyword add channel support
detect_keyword:
    `/setkeyword` allow for any chat type
    add `msg.From` nil check in  `keywordDetector()` function
    add `detectkw_g_switch` error callback answer
    update message in group function manager keyboard
    send error message when failed to parse chat ID
handler_state.go:
    add `opts.Message.From` nil check in `RunStateHandler()` function
utils.go:
    add `msg.From` nil check in `GetMessageFromHyperLink()` function
2025-07-30 01:08:55 +08:00
8f2cab65da use delete_this_message to replace other delete action 2025-07-30 00:00:55 +08:00
1313bee157 add startgroup button for detect keyword
contain:
    remove `ChatType` func
    add `AnyType` func
internal_plugin:
    allow all chat types for `/start` and `/help` commands
    only show default help message in `private` chat type
    add underline suffix to `WithPrefixHandler.Prefix` field when checking command prefix
handler_command_slash_start.go:
    change default chat types
2025-07-29 23:47:11 +08:00
84f2ddfb77 merge mpeg4gif to gif 2025-07-29 22:03:12 +08:00
517ea2d5a8 add chat member change log
update.Message:
    NewChatMembers
    LeftChatMember
update.ChatMember
2025-07-29 21:38:37 +08:00
9d9449261a refactor inline_utils
inline_utils:
    add inline query parser
configs:
    add `InlineCategorySymbol` config flag
handlers.go:
    show match prefix inline commands when user typing
saved_message:
    work with inline category feature
2025-07-29 00:37:19 +08:00
092b736e55 rename sub_package_plugin.go to base.go 2025-07-27 11:50:17 +08:00
57bbde12b8 remove mess package
`ReadLog()` and `OutputVersionInfo()` function move to `utils.go`
2025-07-27 11:05:06 +08:00
bad6e0d7ab make inline utils as a package 2025-07-27 10:52:57 +08:00
c486598d81 fix inline keyword matching
contain.go:
   fix the reversed parameters in`SubString` and `SubStringCaseInsensitive` functions
2025-07-27 10:19:01 +08:00
db7031d46e hide button when command from non-admin 2025-07-26 22:35:42 +08:00
797c841889 add notice mode selector for teamspeak
utils.go:
    add GetChatAdminIDs function
plugin_udonese.go:
    reuse logger field
2025-07-26 20:41:15 +08:00
084936ae48 fix utils.GetUserOrSenderChatDict() logic 2025-07-26 03:05:41 +08:00
fd190b3a0f refactor
handlers.go:
    add document log
    refactor `messageHandler()` function, it now is update type `message` handler
    the parameter type of `inlineHandler()` function is changed to `*handler_params.InlineQuery`
    the parameter type of `callbackQueryHandler()` function is changed to `*handler_params.CallbackQuery`
config.go:
    change default log file to `warn`
handler_by_chatid.go,
handler_command_full.go,
handler_command_slash.go,
handler_command_slash_start.go,
handler_command_suffix.go,
handler_state.go:
    only allow `MessageHandler`
handler_by_message_type.go:
    only allow `MessageHandler`
    copy `update.CallbackQuery.Message.Message.ReplyToMessage` to `params.Message` in `SelectByMessageTypeHandlerCallback()` function
handler_callback_query.go:
    only allow `CallbackQueryHandler`
handler_inline.go:
    only allow `InlineHandler`
handler_message.go:
    add to tigger `slash`, `full` and `suffix` command
message_type.go:
    add `.Str() string` method for `MessageType` and `MessageTypeList` type
update_type.go:
    add `.Str() string` method for `UpdateType` and `UpdateTypeList` type
contain.go:
    add to replace `utils.AnyContains()` function
utils.go:
    remove `AnyContains()`, `checkNested()`, they are replaced by functions in `contain.go`
    remove `getCurrentGoroutineStack()` function
    add nil check for `ShowUserName()`, `ShowChatName()` function
plugin_sticker.go:
    edit message keyboard after success collect sticker set
2025-07-26 02:39:33 +08:00
874b73e338 remove image preview 2025-07-25 06:10:34 +08:00
40a8e7691e fix by chat ID handler for any chat logic 2025-07-23 01:21:59 +08:00
35bca8dc4d try fix udonese handler error 2025-07-23 00:45:03 +08:00
c65c4d8a27 add by chat ID handler check 2025-07-22 02:42:36 +08:00
a7cacb6cd7 refactor
multiple err use error template
move some field in top logger
other changes
2025-07-22 02:27:06 +08:00
c59c67f4b4 rename flate to flaterr 2025-07-21 20:06:29 +08:00
71ecf95d42 only unpin old user list message 2025-07-21 00:35:06 +08:00
8994b76bc1 change ts3 edit message idle time to 12*5 second 2025-07-20 23:04:29 +08:00
c95bbe7b03 use timestamp as build time
internal_plugin:
    add a `delete_this_message` callback query handler to delete any message trigger it
handler_callback_query:
    fix `CallbackDatePrefix` field to `CallbackDataPrefix`
2025-07-20 22:57:29 +08:00
ed0a1c8a83 fix add keyword logic
detect_keyword:
    use format error message
internal_plugin:
    add a `/cancle` command to let user know there is no state handler
handler_state:
    show plugin name when user send `/cancle` command
2025-07-20 22:23:20 +08:00
097e39316e add CancelHandler func and message notice 2025-07-20 00:04:21 +08:00
e60513feca add state handler
state example in `detect_keyword`
2025-07-19 23:44:49 +08:00
07a74932dd make teamspeak pin message user list work
add `PinnedMessage` type in `message_utils`
2025-07-19 20:51:53 +08:00
315d42790f test add pin message user list 2025-07-18 23:45:29 +08:00
dd34bfd157 remove wrong error message 2025-07-17 20:51:36 +08:00
77435cbbcd add convert mpeg4gif to GIF file
show GIF and video file ID in log
2025-07-17 20:06:57 +08:00
1fc55c4588 also delete by message type keyboard after use 2025-07-15 19:38:34 +08:00
83b9b27e6d add by message type handler for saved message
`handler_by_message_type.go`:
   fix any chat ID handler trigger
2025-07-14 22:44:40 +08:00
288e57dc42 add by inline command to send media via fileid
fix callback query log panic
2025-07-14 21:22:06 +08:00
5740ef7bef fix database judgment logic 2025-07-14 20:14:40 +08:00
b022f6f017 refactor
`message_utils` and `update_utils`:
    rename `InString` method to `AsValue`
`handlers.go`:
    make select sub handler logic as function
`ByChatIDHandler` and `ByMessageTypeHandler`:
    remove `MessageHandler` field
`plugin_udonese.go`:
    fix double answer
    add break when matched
`handler_by_chatid.go`:
    add handler duplicate check
`handler_by_message_type.go`:
    add handler duplicate check
    support limit handler trigger for some chat only (by set chat ID)
2025-07-13 01:12:16 +08:00
2b93bba725 update go-telegram/bot to v1.16.0 2025-07-10 23:41:35 +08:00
1111c3155d delay custom logger and multiple error 2025-07-10 19:51:42 +08:00
8751416074 merge err_template and flat_err to flate
change log message template as a string type
rename `handler_slash_start.go` to `handler_command_slash_start.go`
2025-07-08 23:55:48 +08:00
32c2e0f29c move run action as function
rename source code file
2025-07-07 21:39:32 +08:00
c4cf329f3e delete message effect 2025-07-07 20:11:30 +08:00
43f7e96168 auto delete reconnect success message
client change no include bot anymore
start reconnect when check online client error is `not connected`
2025-07-07 04:11:53 +08:00
bc91279e08 add /searchlinks command
rename some add plugin function
change `/test` command link from group to channel
2025-07-06 22:44:02 +08:00
0240070c2b add search_images plugin
use `database.UpdateOperationStatus()` to update user `HasPendingCallbackQuery` status
`saved_message` use another file to init
2025-07-06 21:42:12 +08:00
1240f34646 fix handler by chat ID panic 2025-07-06 02:00:36 +08:00
94c249846b add handler_params for each update type
packages:
    rename `errt` to `err_template`
    rename `multe` to `flat_err`
    rename `handler_structs` to `handler_params` with changes
logger:
    move some fields to top logger
    create sub logger when need
handler and sub-handler:
    create sub params when need
plugin_utils:
    rename `CustomSymbolCommand` to `FullCommand`
    rename `SlashSymbolCommand` to `SlashCommand`
2025-07-06 01:51:47 +08:00
317589b3a6 add webhook url check 2025-07-04 20:34:29 +08:00
c21de3fcb1 Merge pull request 'refactor logger' (#2) from log into alpha
Reviewed-on: #2
2025-07-04 01:26:42 +08:00
f4e904ef4d refactor yaml database logger
plugin_sticker:
    add sticker collect to channel feature
    allow detected `addsticker` link and show download sticker set button
database:
    remove `IsInitialized` and `InitializedErr` in `DatabaseBackend` struct
    add `context.Context` params in `DatabaseBackend.Initializer`
yaml_db:
    using `yaml.LoadYAML()` and `yaml.SaveYAML()` to save database file
    using `zerolog` logger replace `log`
    fix database file protection logic
    remove `addToYamlDB()` func
    update `Database.UpdateTimestamp` when change some flag
handlers:
    fix `CustomSymbolCommand` trigger: use `strings.HasPrefix()` to replace `utils.CommandMaybeWithSuffixUsername()`, custom symbol command will not include robot username suffix
consts:
    rename `YAMLDataBasePath` to `YAMLDataBaseDir`
mess:
    remove `PrintLogAndSave()` func
2025-07-04 00:54:31 +08:00
8a7ca0f0b4 add plugin database map nil check
show photo file id when get photo message
2025-06-30 21:52:49 +08:00
cc3dba55c4 use index as key meaning result ID 2025-06-28 16:09:32 +08:00
c99369a540 refactor saved message logger 2025-06-28 15:12:00 +08:00
45a431134f show a info log when download sticker/set 2025-06-27 05:06:23 +08:00
750360733c refactor limit message
show message delete notice on test mode (whatever delete or not)
add some icon in main menu
display 3 message type button in one line
2025-06-27 04:43:23 +08:00
22123a2c18 save changes
handlers.go:
    fix wrong var
utils/yaml/yaml.go
    remove fmt package
plugins/teamspeak:
    allow check online client failed 5 times before reinit
all and other:
    use err template
    plugin use yaml.Load() and yaml.Save() manage databases
    use mult error to recored all error
2025-06-26 03:23:08 +08:00
17fca9af22 refactor udonese mult error
add send document template
2025-06-25 07:20:00 +08:00
99118ef71c refactor detected keyword logger
change /version command
not need delete /version message
allow select chat after add keyword
some user interface change
2025-06-25 01:00:27 +08:00
baeed5841a refactor teamspeak3 logger 2025-06-24 05:52:52 +08:00
39263085fe add a handler to show cached packs 2025-06-24 04:49:39 +08:00
d5fa515ded change ffmpeg convert gif flag 2025-06-24 04:24:24 +08:00
1dc9864f96 refactor udonese logger
use path to run ffmpeg
auto convent webm to gif if have ffmpeg path
fix callback query just return
2025-06-24 04:16:23 +08:00
7524f98d59 save changes
add log file level
adjust logger create and set level
use logger.Fatal() replace os.Exit(1)
2025-06-23 09:24:09 +08:00
827bc3fb68 move some log into func 2025-06-20 23:50:01 +08:00
985f0c88dc save change
update some log's level
show error when build without info
add commit tag to panic catcher
2025-06-15 00:59:52 +08:00
7ebd6a911f save changes
use mult writer and filter to save different level log to log file
add makefile to build and inject version info
use `github.com/pkg/errors` and zerolog to print stack and save it
2025-06-14 08:14:27 +08:00
7a0e719c88 save changes 2025-06-11 01:58:07 +08:00
60e3c95828 save changes
add convert webm to gif use external ffmpeg
use `update_utils.GetUpdateType()` get update type then run handlers
remove `IsDebugMode` flag
2025-06-10 00:17:57 +08:00
c3c3e6de45 save change
format redis database logs
only need single redis database
2025-06-08 21:06:27 +08:00
139171e689 save changes 2025-06-08 03:40:53 +08:00
3f72534a99 save changes
make error log use `Failed to` first
add full log to `plugin_sticker`
2025-06-08 03:19:25 +08:00
bddb042f90 save changes
add a `IsFromBusinessBot` flag to `message_attribute` package
add `GetUserOrSenderChatDict()` func in some case to replace `GetUserDict()` func
2025-06-06 01:17:42 +08:00
456fad99d1 save changes
fix some redis error
database SaveDatabase and ReadDatabase  can be nil
2025-06-02 00:19:50 +08:00
08287f0aac save changes 2025-05-31 17:30:42 +08:00
d1972da685 save changes 2025-05-30 16:43:15 +08:00
67e1365c71 refactor
add `SaveDatabase` and `ReadDatabase` database operate function
import `github.com/rs/zerolog` use as logger
move most config into yaml config file
use `filepath.Join()` to combine file path
separate some function from `utils`
move signal channel to `signals` package
make exit code in `SignalsHandler()`
change debug script output directory to `${workspaceFolder}/__debug_bin`
2025-05-29 01:59:07 +08:00
664514ef0f add AllowAutoTrigger flag
can show a keyboard when have more that one handler by message type
if  `AllowAutoTrigger` flag not true, also show a keyboard to let user select
add some comment
2025-05-18 00:05:21 +08:00
034e00680b use tsClient.Close() to close client 2025-05-17 23:39:52 +08:00
d20e4a42da add more logout action before reinit
move remove handler by chat ID action into `listenUserStatus()` function
2025-05-17 21:52:41 +08:00
03b2a8efc1 make handler by message type work
add a `(MessageType)InString()` func can output messtype as a `MessageTypeList` (string) type
refactor `handler_by_message_type` package
register `EchoStickerHandler()` func as a handler by message type handler
update no default handler by message type tips in private chat
2025-05-16 00:04:33 +08:00
24acba0bba save changes 2025-05-15 02:05:58 +08:00
218eaf05d0 rename handler_utils to handler_structs
structs `SubHandlerOpts` rename to `SubHandlerParams`
2025-05-15 00:05:39 +08:00
838e9751dd try fix reconnect error
make polling interval as a variable
2025-05-14 20:57:50 +08:00
737f77e86a split type_utils package 2025-05-13 01:03:23 +08:00
cfa539c046 rename package update_type to type_utils 2025-05-13 00:59:50 +08:00
7104e3e488 remove debug log 2025-05-13 00:46:12 +08:00
c628b3cfc7 make saved message as a sub-package plugin
auto squash text or caption when its too long (maybe with some bug)
fix origin info from user error
2025-05-13 00:41:01 +08:00
4ef2185892 create a PanicCatcher to recover from panic
fix `helpCallbackHandler` can't show no plugin help alert
2025-05-13 00:32:46 +08:00
5275277777 rename package plugin_init to internal_plugin 2025-05-12 23:24:16 +08:00
e1e8b63afa make plugin use handler by chat id 2025-05-12 23:03:40 +08:00
38014dbe87 add duplicate check for other type 2025-05-10 13:52:05 +08:00
7c2ee3968e make originInfo as a pointer to avoid empty value 2025-05-10 11:46:00 +08:00
cdb195e9d9 add same description case 2025-05-10 01:32:35 +08:00
bd56f3ea6f add duplicate check for sticker 2025-05-10 01:20:29 +08:00
77636377ff add from & message link button
reorder structs
stop save `MessageOriginHiddenUser` type
2025-05-10 00:25:39 +08:00
e658ed4e8e show some log only at debug 2025-05-09 22:09:21 +08:00
675d1aad95 try record message info for savedmessage 2025-05-08 21:37:07 +08:00
29eb97a2bf rename package updatetype to update_type 2025-05-08 21:34:32 +08:00
818587881f fix GetMessageAttribute panic
`https://github.com/go-telegram/bot/pull/175`
2025-05-01 00:09:22 +08:00
d977f7eabb add goroutine stack printer
from `https://jasonkayzk.github.io/2021/09/26/在Golang发生Panic后打印出堆栈信息/`
update top-level handler recover log
2025-04-30 23:21:36 +08:00
0d883e01db fix sticker set download panic 2025-04-30 23:06:19 +08:00
aed26ab2b9 add help text for plugins
allow add reply markup in help text
add a `inline_default_noedit_` prefix for change default command for inline mode but not edit message
2025-04-30 22:50:33 +08:00
4c6955d3c7 fix bot can't edit callbackquery msg in group 2025-04-30 22:47:34 +08:00
ca53f4993e add sticker/pack download count 2025-04-30 20:06:18 +08:00
b32bb3fbd3 upgrade go-telegram/bot to v1.15.0 2025-04-30 20:02:50 +08:00
095a963b49 fix sticker pack filename error 2025-04-30 02:19:12 +08:00
9e58e9b874 ts3: make more check and error info 2025-04-30 02:00:20 +08:00
ef549dc6d3 fix handler by chatID trigger 2025-04-30 01:56:18 +08:00
6d4d41c465 teamspeak try use handler by chatID to get opts 2025-04-28 22:34:36 +08:00
122408940a refactor handler by chat id use double map 2025-04-28 22:32:41 +08:00
b09f172f39 try add teamspeak3 2025-04-27 21:41:43 +08:00
a5f591c85e Add generic yaml read/save function
add debug script from v2ex
some comment
2025-04-27 16:02:57 +08:00
82c4695473 add keyword limit in group
add inline button when saved message
2025-04-27 14:25:30 +08:00
bf8133720b hide global keyword when user disable
add chat disable by admin description
fix when disabled for group, rebuild listen list will add duplicate user ID
2025-04-22 04:31:41 +08:00
be1f39fb91 add help handler
move helpHandler and startHandler to build-in handler
2025-04-22 03:53:13 +08:00
737ae417a4 show default name when sticker is custom 2025-04-21 23:02:18 +08:00
fa03d7044f move sticker cache path to plugin
show sticker info when user send a sticker
also using sticker pack info as sticker filename
2025-04-19 02:25:31 +08:00
3e419f333e try init handler by message type
fix error voice link
2025-04-18 03:06:32 +08:00
87cbe5253e add panic recover 2025-04-18 01:46:50 +08:00
066a28c0df fix invalid default inline plugin crash
add more select default inline plugin button
change `plugin_voicelist` from `InlineManualHandler` to `InlineHandler`
2025-04-15 15:15:42 +08:00
fdda5053a5 make saved message support only text message 2025-04-14 23:45:24 +08:00
7cc8110b4c make utils.AnyContains() not case sensitive 2025-04-14 23:44:32 +08:00
83892d6bb9 format build-in plugins 2025-04-14 22:10:54 +08:00
fa20d22193 add GetMessageFromHyperLink func 2025-04-14 21:40:19 +08:00
5b2a26ac2a use <blockquote expandable> tag 2025-04-14 20:29:31 +08:00
08b431fce5 show ID use utils.RemoveIDPrefix() 2025-04-14 00:54:03 +08:00
d4485d4066 add global keyword detect
allow add keyword in group
stop add repeated keyword
add mention count
show message from in mention
can show msg from user as channel or group anonymous
2025-04-14 00:53:24 +08:00
e40b1b502b fix inline flag display 2025-04-13 01:01:10 +08:00
6211922add add attr for inline handler
use single string var for default inline handler
fix empty meaning list panic for udonese
rename structs name in plugin_utils
stop add plugin without command or argument flag
add some check in utils
2025-04-13 00:53:02 +08:00
0ef52009be hide most button while user disable detect keyword 2025-04-11 00:38:57 +08:00
5caa13cd58 group default enable in detect keyword 2025-04-11 00:32:57 +08:00
0ac54c3b95 fix chat for user keyword count 2025-04-11 00:14:35 +08:00
e906daec4c fix button and init user for detect keyword 2025-04-10 23:41:38 +08:00
f22b28c7f3 udonese add keyword manager 2025-04-10 23:17:59 +08:00
d859775dfa detect keyword support delete keyword 2025-04-10 23:16:16 +08:00
59eefc45af fix limit message can't show some options 2025-04-10 22:56:51 +08:00
f7d0e47a08 Update plugin_detect_keyword.go 2025-04-09 00:23:55 +08:00
318d03ec28 make detect keyword work
add TextForTrueOrFalse() to package utils
2025-04-08 16:52:04 +08:00
b9f711995e update detected keyword
add RemoveIDPrefix() func in utils
ignore `/db_yaml/detectkeyword` folder
2025-04-05 23:18:30 +08:00
9cc46f11c4 save changes 2025-04-05 02:11:07 +08:00
62a5ff7dab change plugin database saver log 2025-04-03 22:49:13 +08:00
1f4e978cf6 rename plugins 2025-04-03 22:48:10 +08:00
d3df613046 rename plugin_utils 2025-04-02 16:36:42 +08:00
a5f4c47e94 add handler by chat id method
make udonese handler as a handler by chat id
remove pre callbackquery answer
2025-03-29 22:00:47 +08:00
320092451f plugin databases handler
can set inline default command
add plugin handler nil check (while use, need precheck)
2025-03-29 19:22:36 +08:00
f0bfe2c920 done limitmessage
I didn't know how to modify the logical operators, so I left a switch
2025-03-29 17:20:35 +08:00
ff6a5cc952 make limitmessage work 2025-03-29 11:34:59 +08:00
c908cf1745 refactor plugin_forwardonly
rename function in savedmessage
2025-03-29 01:19:29 +08:00
15e80be4b1 make plugin_voicelist work 2025-03-27 23:22:33 +08:00
02363f4dfb make plugin_savedmessage work
add init() for plugin_sticker
move `/start via-inline_noreply` as build-in handler
ignore `/db_yaml/savedmessage` path
2025-03-27 23:10:28 +08:00
609d1110c5 rename database backend and more
change voices urls
use strings.EqualFold to compare udonese word
2025-03-27 21:07:34 +08:00
0f58a4e13c manual init database backend 2025-03-27 16:14:30 +08:00
bf8529549b database and plugins
auto init plugins using package-specific `init()` func
todo: database can't use `init()` func
2025-03-26 00:18:17 +08:00
c1c4036b72 database and structs 2025-03-22 02:27:03 +08:00
72f6c32f0f record usage in redis 2025-03-21 17:04:40 +08:00
2916286c90 database, inline plugin and structs 2025-03-21 03:03:28 +08:00
9db9420093 stop using same gob encoder 2025-03-19 00:35:38 +08:00
51c4128de9 redis test 2025-03-19 00:25:31 +08:00
656554bb87 Split Modules 2025-03-18 16:55:30 +08:00
cf391f0b06 user send message as a channel 2025-03-18 13:15:57 +08:00
e6be6717e9 remove keyword count 2025-03-18 00:22:53 +08:00
7a3b5527c3 change first inline handler 2025-03-18 00:19:39 +08:00
73635755c0 udonese: channel/group info 2025-03-18 00:00:21 +08:00
629f188209 save changes 2025-03-16 01:54:50 +08:00
861a2cd953 save changes 2025-03-15 19:33:33 +08:00
480d74844f save changes 2025-03-09 23:09:10 +08:00
6773983886 save changes 2025-03-04 03:33:14 +08:00
65b761816f save changes 2025-03-01 01:59:27 +08:00
c5636bf8af save changes 2025-02-28 16:48:48 +08:00
a8d36e9154 save changes 2025-02-28 00:44:53 +08:00
601a82f1c8 save changes 2025-02-27 00:38:07 +08:00
ac955746ff save changes 2025-02-26 16:57:08 +08:00
5cd3e33471 savechanges 2025-02-22 17:27:53 +08:00
b914c0353c savechanges 2025-02-22 03:40:43 +08:00
9fdaca14a1 save changes 2025-02-21 02:39:00 +08:00
d728ad10bf save changes 2025-02-19 22:37:34 +08:00