#Guild Tag

1 messages · Page 1 of 1 (latest)

finite scaffold
#

if i have

async def on_user_update(self, before, after):
  if before.primary_guild is not None and after.primary_guild.guild_id == after.guild.id:
    some container which sends to logchannel and other stuff

why it triggers not only tag, but every member update, what is wrong in my ifs, i tried a lot of prints, and i dont understand why primary guild always equals to primary guild

#

i tried this

if (before.primary_guild.guild_id != after.primary_guild.guild_id):

and the same with .badge and idk that am i missing here

sinful tulip
#

because for any member update where the member already has your guild's tag, it goes into the if

finite scaffold
sinful tulip
#

if they actually change their tag

finite scaffold
sinful tulip
#

also it's primary_guild.identity_guild_id

sinful tulip
#

but dont wrap it in parentheses

finite scaffold
#

i dont really see where identity_guild_id in the docs but it returns id of tag guild id, right?

sinful tulip
#

primary_guild.guild_id does not exist

finite scaffold
#

when i do these

if before.primary_guild.identity_guild_id != after.primary_guild.identity_guild_id:

it just doesnt go into if

sinful tulip
#

have you checked whether the event actually fires for tag changes?

finite scaffold
sinful tulip
#

did you test that by changing your tag? and made sure its actually you in the event?

finite scaffold
#

yeap

#

i have like three my guilds and bot only on one of them

sinful tulip
#

Does it stick to the old or the new one?

finite scaffold
#

new one

sinful tulip
#

I tried finding the code responsible for this in pycord but tbfh i can't really find it
I think it's either a cache issue, or pycord handling the event incorrectly, but someone more familiar with the library's internals will have to say for sure

finite scaffold
#

yeap that’s the problem, it is impossible to find through search someone who did it with right code

#

i saw it only here #1421011083728130088 message

#

and there before_tag_id becomes just id of server, then what was the point to write these stuff, i dont really got his idea

sinful tulip
#

And just to make sure, you are actually changing your tag to a different server's tag, right

#

Well as I said, it's most likely a bug somewhere

finite scaffold
#

maybe, i will try to do maybe via db

#

thanks anyway!

opal crag
#

what's happening exactly?

sinful tulip
#

for user updates, before seems to have the same primary guild as after when changing the tag

#

both have the new one apparently

opal crag
#

yeah primary_guild is never updated

sinful tulip
#

let me try to repro and fix

opal crag
#

you'll need to check _update_inner_user, _update and _copy for Member & User

sinful tulip
#

i cant even get the event to fire at all

#

doesnt do anything on tag change

finite scaffold
#

i think it discord's problem maybe

sinful tulip
#

yea, the event doesnt even fire

#

something i specifically asked for, but thats why i never trust what anyone says in support servers

opal crag
#

it doesn't fire if _update_inner_user doesn't return that anything has changed

#

and currently'it doesnt even check that

#

afaik

sinful tulip
#

yea, im trying smth

grave surge
#

its not a problem on discords side. i use it in my own lib fine

finite scaffold
grave surge
#

i dont use python

finite scaffold
#

like what u check to understand that tag changed

sinful tulip
#

The event does not currently do this

finite scaffold
sinful tulip
#

im trying to see what i need to change to fix it

grave surge
#

its def a pycord problem

finite scaffold
#

i saw only js

grave surge
finite scaffold
#

ohh

sinful tulip
#

thanks

opal crag
#

this fuckery is all from dpy tbh

grave surge
#
    public static Task OnGuildMemberUpdated(DiscordClient client, GuildMemberUpdateEventArgs args)
    {
        _ = Task.Run(async () =>
        {
            var hasTag = args.Member.PrimaryGuild is not null && args.Member.PrimaryGuild.IdentityEnabled;

            if (hasTag && BlacklistService.BlacklistedGuildIds.Contains(args.Member.PrimaryGuild!.IdentityGuildId!.Value.ToString()))
            {
                await BlacklistService.PunishBlacklistedTagUserAsync(client, args.Guild, args.Member);
                return;
            }

            if (args.Member.RoleIds.Contains(RawrConstants.TagBlacklistRoleId) && (!hasTag || !BlacklistService.BlacklistedGuildIds.Contains(args.Member.PrimaryGuild!.IdentityGuildId!.Value.ToString())))
                await BlacklistService.RevokeBlacklistedTagPunishmentAsync(client, args.Guild, args.Member);
        });
        return Task.CompletedTask;
    }

tbf i dont check the before after, just the after, but it def works on the gw

grave surge
sinful tulip
#

This seems to be all that's needed to change

grave surge
#

ig

#

pr it, i'll merge

sinful tulip
#

i love that global name line tbfh

#

none or none

grave surge
sinful tulip
#

dangit title was wrong

#

@finite scaffold Thank you for bringing this up, once the above pull request is merged and 2.7.1 releases this will work as intended, and before.primary_guild != after.primary_guild will return true if the before and after tags differ, as expected

finite scaffold
#

🥸❤️

sinful tulip
#

It's now merged into master, if you wanna give it a try already @finite scaffold