File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import { BlacklistService } from "./command/blacklist";
1313import { UserService } from "./db/user" ;
1414import { GroupMembershipService } from "./db/group/Membership" ;
1515import { MESSAGE } from "../helper/message" ;
16+ import { RateLimiter } from "../helper/RateLimiter" ;
1617const logger = new Logger ( { file : "join_group.log" , level : "info" } ) ;
1718
1819export class MessageCheck {
@@ -78,6 +79,11 @@ export class MessageCheck {
7879 }
7980
8081 static async isAdmin ( ctx : Context , userId : number ) : Promise < boolean > {
82+ if ( ! RateLimiter . limit ( ctx . chat ! . id ) ) {
83+ // If rate limit exceeded, you might want to log or handle it accordingly
84+ logger . warn ( 'Rate limit exceeded for getChatAdministrators.' ) ;
85+ return false ;
86+ }
8187 const chatAdmins = await ctx . getChatAdministrators ( ) ;
8288 return chatAdmins . some ( ( admin ) => admin . user . id === userId ) ;
8389 }
You can’t perform that action at this time.
0 commit comments