|
1 | | -import { Context, InlineKeyboard } from 'grammy'; |
| 1 | +import { Context } from 'grammy'; |
2 | 2 | import { BotReply } from '../../../utils/chat/BotReply'; |
3 | 3 | import { Catch } from '../../../decorators/Catch'; |
4 | 4 | import { AdminValidationService } from '../../service/admin/validation'; |
5 | 5 | import { ApprovedService } from '../../service/admin/Approved'; |
6 | 6 | import { BanService } from '../../service/admin/Ban'; |
7 | 7 | import { WarnService } from '../../service/admin/Warn'; |
8 | | -import { parseDuration, tehranZone } from '../../../utils'; |
9 | 8 | import { MuteService } from '../../service/admin/Mute'; |
10 | 9 | import { AdminService } from '../../service/admin/Admin'; |
11 | 10 | import { BlackListService } from '../../service/admin/Blacklist'; |
12 | 11 | import { ChatInfo } from '../../../utils/chat/ChatInfo'; |
13 | 12 | import { GroupSettingsService } from '../../service/admin/Welcome'; |
| 13 | +import { User } from 'grammy/types'; |
14 | 14 | export class AdminCommands { |
15 | 15 | /** Approved Commands */ |
16 | 16 | @Catch({ |
@@ -119,8 +119,11 @@ export class AdminCommands { |
119 | 119 | } |
120 | 120 | static async warns(ctx: Context) { |
121 | 121 | const reply = new BotReply(ctx); |
122 | | - const user = ctx.message?.reply_to_message?.from!; |
123 | | - |
| 122 | + const replyMessage = ctx.message?.reply_to_message; |
| 123 | + let user = ctx.message?.reply_to_message?.from!; |
| 124 | + if (replyMessage?.forum_topic_created) { |
| 125 | + user = ctx.from!; |
| 126 | + } |
124 | 127 | const { warnings } = await WarnService.getUserWarnById(ctx); |
125 | 128 |
|
126 | 129 | if (warnings >= 0) { |
|
0 commit comments