Advertisement
ZeroSeventty

Invite to chat command

Apr 20th, 2022
818
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  ​async​ ​function​ ​invite​(​bot​,​ ​message​){
  3.  
  4.  ​                ​let​ ​botInfo​ ​=​ ​await​ ​bot​.​getMe​(),
  5.  ​                        ​botStats​ ​=​ ​await​ ​bot​.​getChatMember​(​message​.​chat​.​id​,​botInfo​.​id​);
  6.  ​                ​if(​botStats​.​status​ ​!=​ ​"administrator"​ ​||​ ​botStats​.​can_invite_users​ ​==​ ​false){
  7.  ​                        ​bot​.​sendMessage​(​message​.​chat​.​id​,"No tengo permisos. (esto se debe a que no soy administradora o no tengo permisos de invitar)");
  8.  ​                ​}else{
  9.  ​                        ​bot​.​exportChatInviteLink​(​message​.​chat​.​id​);
  10.  ​                        ​let​ ​chatInfo​ ​=​ ​await​ ​bot​.​getChat​(​message​.​chat​.​id​);
  11.  ​                        ​bot​.​sendMessage​(​message​.​chat​.​id​,​ ​`Aqui tienes un ticket de entrada [🎟](​${​chatInfo​.​invite_link​})`​,​ ​{​parse_mode​ : ​"Markdown"});
  12.  ​                ​}
  13.  ​};
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement