• If you need help or want to discuss things, you now can also join us on our Discord Server!

Bug clientMove event triggers two times when creating a channel

Kavatch

Member
Hey,
as the Title already says, my clientMove event somehow does trigger twice after I create a channel. However, the second one to trigger does not have a fromChannel defined.
Example:
JavaScript:
event.on("clientMove", (event) => {
    let client: Client = event.client;
    engine.log(`[MOVE] fromChannel: ${event.fromChannel} | toChannel: ${event.toChannel.name()} | client: ${event.client.name()} | invoker: ${event.invoker.name()}`);
});
Will output the following:
Code:
2020-01-01T13:24:38+01:00 [ main:132:16] [MOVE] fromChannel: undefined | toChannel: afsdfds | client: MrKavatch | Alex1 | invoker: undefined
2020-01-01T13:24:38+01:00 [ main:132:16] [MOVE] fromChannel: [object Object] | toChannel: afsdfds | client: MrKavatch | Alex1 | invoker: undefined
The problem I have now is that the documentation says:
Code:
fromChannel (Channel?) : Old channel (or null if the client just got online/changed visibility)
toChannel (Channel?) : New channel (or null if the client just went offline/changed visibility)
So I cant think of a way to work around this issue since every time a Clients creates a new Channel it will look like he has just joined the server.
Also before I forget to mention: The Bot has Server Admin and can see every client in every channel.

System Information:
Code:
[email protected]:~$ neofetch
       _,met$$$$$gg.          [email protected]
    ,g$$$$$$$$$$$$$$$P.       ---------------
  ,g$$P"     """Y$$.".        OS: Debian GNU/Linux 10 (buster) x86_64
,$$P'              `$$$.     Host: Google Compute Engine
',$$P       ,ggs.     `$$b:   Kernel: 4.19.0-6-cloud-amd64
`d$$'     ,$P"'   .    $$$    Uptime: 1 day, 3 hours, 41 mins
$$P      d$'     ,    $$P    Packages: 448 (dpkg)
$$:      $$.   -    ,d$$'    Shell: bash 5.0.3
$$;      Y$b._   _,d$P'      Terminal: /dev/pts/0
Y$$.    `.`"Y$$$$P"'         CPU: Intel Xeon (1) @ 2.300GHz
`$$b      "-.__              Memory: 505MiB / 1691MiB
  `Y$$
   `Y$$.                                            
     `$$b.
       `Y$$b.
          `"Y$b._
              `"""
Sinusbot Version: SinusBot 1.0.0-beta.5-b262b6a
 

Flosing

Donor
Tier I
is awesome!
is uber awesome!
For me it looks like the event will come from notifyChannel and once from notifyServer. You need the notifyChannel. You can simply skip every second call by code
 

Kavatch

Member
For me it looks like the event will come from notifyChannel and once from notifyServer. You need the notifyChannel. You can simply skip every second call by code
Sorry but I am note quite sure what you mean by that.
The problem I am having is that my script will think the player has joined again when he creates a channel. Because the documentation says so. I also cant skip every seconds call because it then will skip every seconds join event. To be precise: I cant think of a feasible way to differentiate if a client has joined or if he just created a new channel.
 

Montiary

Donor
is awesome!
Contributor
here is my workarround


Code:
        if(Client.isSelf()){
            return;
        }
        
        if(!FromChannel && (tochannel.isPermanent() || tochannel.isSemiPermanent())){
            engine.log("joined the server");
        }else if(!FromChannel){
            engine.log("joined a temp channel");
        }
 
Top