@@ -3,6 +3,7 @@ import { Command } from "../../controller/command";
33import { CmdMid } from "../../middleware" ;
44import { botIsAdmin } from "../../middleware/isAdmin" ;
55import { COMMANDS } from "../../helper" ;
6+ import { Logger } from "../../config/logger" ;
67export class GenerateCommand {
78 private bot : Bot ;
89 constructor ( bot : Bot ) {
@@ -11,7 +12,7 @@ export class GenerateCommand {
1112 private create ( name : string , mids ?: ( ( ctx : Context , next : NextFunction ) => Promise < void > ) [ ] ) {
1213 const middleware = mids ? this . compose ( mids ) : undefined ;
1314 if ( middleware ) {
14- this . bot . command ( name , botIsAdmin , middleware , Command . handleCommand ) ;
15+ this . bot . command ( name , middleware , botIsAdmin , Command . handleCommand ) ;
1516 } else {
1617 this . bot . command ( name , Command . handleCommand ) ;
1718 }
@@ -47,30 +48,31 @@ export class GenerateCommand {
4748 */
4849 generate ( ) {
4950 for ( const command of COMMANDS ) {
50- if ( [ "start" , "help" , "date" , "future" , "rules" , "shahin "] . includes ( command ) ) {
51- this . create ( command ) ;
52- } else if (
53- [ "lock" , "blacklist" , "abl" , "unLock" , "rmbl" , "approvedList" ] . includes ( command )
54- ) {
55- this . create ( command , [ CmdMid . isSupergroupOrChannel , CmdMid . AdminStatus ] ) ;
56- } else if ( [ "purge" ] . includes ( command ) ) {
57- this . create ( command , [ CmdMid . isSupergroupOrChannel , CmdMid . isReplied , CmdMid . AdminStatus ] ) ;
58- } else if ( [ "unBan" ] . includes ( command ) ) {
59- this . create ( command , [
60- CmdMid . isSupergroupOrChannel ,
61- CmdMid . isReplied ,
62- CmdMid . AdminStatus ,
63- CmdMid . adminCheckForRepliedUser ,
64- ] ) ;
65- } else {
66- this . create ( command , [
67- CmdMid . userInGroup ,
68- CmdMid . isSupergroupOrChannel ,
69- CmdMid . isReplied ,
70- CmdMid . AdminStatus ,
71- CmdMid . adminCheckForRepliedUser ,
72- ] ) ;
73- }
51+ if ( [ "start" , "help" , "date" , "future" ] . includes ( command ) ) {
52+ this . create ( command ) ;
53+ } else if ( [ "rules" , "shahin" ] . includes ( command ) ) {
54+ this . create ( command , [ CmdMid . isValidChatType ] ) ;
55+ } else if ( [ "lock" , "blacklist" , "abl" , "unLock" , "rmbl" , "approvedList" ] . includes ( command ) ) {
56+ this . create ( command , [ CmdMid . isValidChatType , CmdMid . AdminStatus ] ) ;
57+ } else if ( [ "purge" ] . includes ( command ) ) {
58+ this . create ( command , [ CmdMid . isValidChatType , CmdMid . isReplied , CmdMid . AdminStatus ] ) ;
59+ } else if ( [ "unBan" ] . includes ( command ) ) {
60+ this . create ( command , [
61+ CmdMid . isValidChatType ,
62+ CmdMid . isReplied ,
63+ CmdMid . AdminStatus ,
64+ CmdMid . adminCheckForRepliedUser ,
65+ ] ) ;
66+ } else {
67+ this . create ( command , [
68+ CmdMid . userInGroup ,
69+ CmdMid . isValidChatType ,
70+ CmdMid . isReplied ,
71+ CmdMid . AdminStatus ,
72+ CmdMid . adminCheckForRepliedUser ,
73+ ] ) ;
74+ }
7475 }
75- }
76+ }
77+
7678}
0 commit comments