File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed
Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ Command | Role | Available at | Description
6868` /staff ` | _ Everyone_ | _ Everywhere_ | Shows a list of admins.
6969` /link ` | _ Everyone_ | _ Everywhere_ | Shows the current group's link.
7070` /groups ` | _ Everyone_ | _ Everywhere_ | Shows a list of groups which the bot is admin in.
71- ` /report ` | _ Everyone_ | _ Everywhere_ | Reports the replied-to message to admins.
71+ ` /report [reason] ` | _ Everyone_ | _ Everywhere_ | Reports the replied-to message to admins, reason is optional .
7272` /commands ` | _ Everyone_ | _ In-Bot_ | Shows a list of available commands.
7373` /help ` \| ` /start ` | _ Everyone_ | _ In-Bot_ | How to use the bot.
7474
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ const userCommands = `\
3737<code>/staff</code> - Shows a list of admins.
3838<code>/link</code> - Show the current group's link.
3939<code>/groups</code> - Show a list of groups which the bot is admin in.
40- <code>/report</code> - Reports the replied-to message to admins.\n
40+ <code>/report [reason] </code> - Reports the replied-to message to admins, reason is optional .\n
4141` ;
4242const role = R . prop ( 'role' ) ;
4343const name = R . prop ( 'name' ) ;
Original file line number Diff line number Diff line change @@ -41,12 +41,21 @@ const reportHandler = async ctx => {
4141 } ) ;
4242 if ( chats . report ) {
4343 const msg = await ctx . telegram . forwardMessage ( chats . report , ctx . chat . id , reply . message_id ) ;
44+
45+ const parts = ctx . message . text . split ( / \s + / )
46+ parts . shift ( ) ;
47+ const reportMessage = parts . join ( ' ' ) ;
48+ let reportReason = ''
49+ if ( reportMessage . trim ( ) !== '' ) {
50+ reportReason = TgHtml . tag `\n\n\nReport reason: <i>${ reportMessage } </i>`
51+ }
52+
4453 await ctx . deleteMessage ( ) ;
4554 await ctx . telegram . sendMessage (
4655 chats . report ,
4756 TgHtml . tag `❗️ ${ link ( ctx . from ) } reported <a href="${ msgLink (
4857 reply ,
49- ) } ">a message</a> from ${ link ( reply . from ) } in ${ ctx . chat . title } !`,
58+ ) } ">a message</a> from ${ link ( reply . from ) } in ${ ctx . chat . title } !${ reportReason } `,
5059 {
5160 parse_mode : 'HTML' ,
5261 reply_to_message_id : msg . message_id ,
You can’t perform that action at this time.
0 commit comments