add_on_send_message_hook()
+ on_send_message_hook(account, params)
| inu.interceptSendMessage(filter, ({ message, account }) => ...)
(needs ) |
if not params.message.startswith('.cmd'): return HookResult()
| filter: non-matching sends never reach JS |
| , , | (a ; assign a string or / result). The caption is too |
| (marked id) |
| , , | , |
| , | ( / ), |
| , | , |
HookResult(strategy=MODIFY / MODIFY_FINAL, params=params)
| mutate , return |
| / | return without changes |
| + + later | async middleware: the work, edit , return (60 s budget, ). Avoid drop-and-resend |
| with nothing to send (local-only command) | return |
pre_request_hook('TL_messages_getHistory', account, request)
| inu.interceptRpc('messages.getHistory', (ctx, next) => ...)
, edit (interceptRpc(messages.getHistory)
) |
post_request_hook(name, account, response, error)
| same middleware: , edit or replace ; an error rejects as |
| in | return a response without calling , or return/throw |
add_hook('TL_updateNewMessage')
+ to modify/drop | inu.interceptUpdate('updateNewMessage', ({ update }) => 'deliver' / 'drop')
|
| / only to react | / / ( etc.), or |
add_hook(name, match_substring=True)
| list exact constructors / methods; there is no substring match |
send_message({'peer', 'message', 'entities', 'replyToMsg', ...})
, | account.sendMessage(peer, md\
...`, { replyToMessageId, topicId, silent })account.write(send)`) |
| , , | / with or |
send_request(TL_x(), RequestCallback(lambda res, err: ...))
| typed account method if one exists, else try { await inu.invokeRpc({ _: 'x', ... }) } catch (e) { if (e instanceof inu.RpcError) ... }
() |
get_messages_controller().getUser(id)
/ / | / / / (, ) |
get_messages_controller().isDialogMuted(...)
| account.isDialogMuted(dialogId, { topicId })
|
get_messages_controller().getUserFull
, | / |
| reads, history loops | account.getMessagesCached
/ / (, ) |
MessageObject.messageOwner.message
, , , media checks | getters: , , , , , , , ; for the rest |
MessageObject.messageText
(what the chat list shows) | account.previewMessage(message)
|
get_user_config().getClientUserId()
, | , () |
UserConfig.selectedAccount
, , get_connections_manager()
| the passed to the handler, , |
get_file_loader().loadFile(...)
, FileLoader.getPathToAttach
| account.downloadMedia(message)
/ |
getSendMessagesHelper().sendReaction
, , , | / / / ( scopes) |
| via | () |
| custom translation via hooks on the translate controller | inu.registerTranslationProvider
|
NotificationCenter.getInstance(acc).addObserver(...)
| the event APIs above first; inu.android.addNotificationCenterDelegate
(unsafe.notificationCenter
+ ) last |
| hooks suppressing system notifications | inu.notifications.suppress()
/ account.suppressNotifications()
() |
markdown_utils.parse_markdown(text)
| (, , , , ), or / |