guildinfo: actually fix local resolving and more invite resolving
This commit is contained in:
		
							parent
							
								
									89480d98d7
								
							
						
					
					
						commit
						9cf3a5a23b
					
				
					 1 changed files with 16 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -74,7 +74,7 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
 | 
			
		|||
 | 
			
		||||
  let clan = await hf.bot.requestHandler.request("GET", APIEndpoints.CLAN(id), true).catch(() => {});
 | 
			
		||||
  if (!clan) {
 | 
			
		||||
    if (_guild?.profile) {
 | 
			
		||||
    if (_guild?.data?.profile) {
 | 
			
		||||
      clan = _guild?.profile;
 | 
			
		||||
    } else {
 | 
			
		||||
      const verif = await hf.bot.requestHandler
 | 
			
		||||
| 
						 | 
				
			
			@ -82,11 +82,21 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
 | 
			
		|||
        .catch(() => {});
 | 
			
		||||
      if (verif?.profile) {
 | 
			
		||||
        clan = verif.profile;
 | 
			
		||||
      } else if (_guild?.vanityURL) {
 | 
			
		||||
        const invite = await hf.bot.requestHandler
 | 
			
		||||
          .request("GET", `${APIEndpoints.INVITE(_guild.vanityURL)}?with_counts=true&with_expiration=true`)
 | 
			
		||||
          .catch(() => {});
 | 
			
		||||
        if (invite?.profile) clan = invite.profile;
 | 
			
		||||
      } else {
 | 
			
		||||
        const code =
 | 
			
		||||
          _guild?.data?.vanityURL ??
 | 
			
		||||
          _guild?.data?.store_page?.guild?.invite?.code ??
 | 
			
		||||
          _guild?.data?.store_page?.role_subscription?.purchase_page_invite?.code ??
 | 
			
		||||
          _guild?.data?.instant_invite?.replace(
 | 
			
		||||
            /(https?:\/\/)?(canary\.|ptb\.)?discord(\.gg|(app)?.com\/invite)\//,
 | 
			
		||||
            ""
 | 
			
		||||
          );
 | 
			
		||||
        if (code) {
 | 
			
		||||
          const invite = await hf.bot.requestHandler
 | 
			
		||||
            .request("GET", `${APIEndpoints.INVITE(code)}?with_counts=true&with_expiration=true`)
 | 
			
		||||
            .catch(() => {});
 | 
			
		||||
          if (invite?.profile) clan = invite.profile;
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue