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(() => {});
 | 
					  let clan = await hf.bot.requestHandler.request("GET", APIEndpoints.CLAN(id), true).catch(() => {});
 | 
				
			||||||
  if (!clan) {
 | 
					  if (!clan) {
 | 
				
			||||||
    if (_guild?.profile) {
 | 
					    if (_guild?.data?.profile) {
 | 
				
			||||||
      clan = _guild?.profile;
 | 
					      clan = _guild?.profile;
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      const verif = await hf.bot.requestHandler
 | 
					      const verif = await hf.bot.requestHandler
 | 
				
			||||||
| 
						 | 
					@ -82,14 +82,24 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
 | 
				
			||||||
        .catch(() => {});
 | 
					        .catch(() => {});
 | 
				
			||||||
      if (verif?.profile) {
 | 
					      if (verif?.profile) {
 | 
				
			||||||
        clan = verif.profile;
 | 
					        clan = verif.profile;
 | 
				
			||||||
      } else if (_guild?.vanityURL) {
 | 
					      } 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
 | 
					          const invite = await hf.bot.requestHandler
 | 
				
			||||||
          .request("GET", `${APIEndpoints.INVITE(_guild.vanityURL)}?with_counts=true&with_expiration=true`)
 | 
					            .request("GET", `${APIEndpoints.INVITE(code)}?with_counts=true&with_expiration=true`)
 | 
				
			||||||
            .catch(() => {});
 | 
					            .catch(() => {});
 | 
				
			||||||
          if (invite?.profile) clan = invite.profile;
 | 
					          if (invite?.profile) clan = invite.profile;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (clan) {
 | 
					  if (clan) {
 | 
				
			||||||
    const images = [];
 | 
					    const images = [];
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue