guildinfo: get profile from existing guild invites if possible
This commit is contained in:
		
							parent
							
								
									593edb2f8e
								
							
						
					
					
						commit
						8f5a5914ba
					
				
					 1 changed files with 8 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -83,7 +83,7 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
 | 
			
		|||
      if (verif?.profile) {
 | 
			
		||||
        clan = verif.profile;
 | 
			
		||||
      } else {
 | 
			
		||||
        const code =
 | 
			
		||||
        let code =
 | 
			
		||||
          _guild?.data?.vanityURL ??
 | 
			
		||||
          _guild?.data?.store_page?.guild?.invite?.code ??
 | 
			
		||||
          _guild?.data?.store_page?.role_subscription?.purchase_page_invite?.code ??
 | 
			
		||||
| 
						 | 
				
			
			@ -91,6 +91,13 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
 | 
			
		|||
            /(https?:\/\/)?(canary\.|ptb\.)?discord(\.gg|(app)?.com\/invite)\//,
 | 
			
		||||
            ""
 | 
			
		||||
          );
 | 
			
		||||
        if (!code && hf.bot.guilds.has(id)) {
 | 
			
		||||
          const invites = await hf.bot.requestHandler
 | 
			
		||||
            .request("GET", APIEndpoints.GUILD_INVITES(id), true)
 | 
			
		||||
            .catch(() => {});
 | 
			
		||||
          if (invites?.[0]?.code) code = invites[0].code;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (code) {
 | 
			
		||||
          const invite = await hf.bot.requestHandler
 | 
			
		||||
            .request("GET", `${APIEndpoints.INVITE(code)}?with_counts=true&with_expiration=true`)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue