#issue with /core

12 messages · Page 1 of 1 (latest)

shy mauve
#

Its my first time trying core since I want to have a lightbuild gateway helper and I think I do something wrong?

This is my current test script

        const gateway = new WebSocketManager({
            token: '',
            intents: GatewayIntentBits.Guilds,
            rest: GatewayManager.getRest(),
        });

        const client = new Client({rest: GatewayManager.getRest(), gateway});

        client.once(GatewayDispatchEvents.Ready, this.onReady);
        client.on(GatewayDispatchEvents.GuildCreate, this.onGuildCreate);
        client.once(GatewayDispatchEvents.GuildDelete, this.onGuildDelete);

        await gateway.connect();

        const shards = await gateway.getShardIds();
        for (const shardId of shards) {
            await gateway.send(shardId, {
                "op": 3,
                "d": {
                    "activities": [{
                        "name": "We love casting spells | Memer.gg",
                        "type": 4
                    }],
                    "status": "online",
                }
            });
        }

The issue I see is that it dont set the status but I thought thats the way to do it? xD

valid cryptBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Not a discord.js issue? Check out #1081585952654360687.
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!
  • Marked as resolved by OP
fleet citrus
#

<Client>.updatePresence() exists
that being said, GatewayPresenceUpdateData objects should also have a couple more properties that you appear to be missing

#

I'd also recommend still using the ActivityType enum (and the GatewayOpcodes enum if you really intend to continue manually sending payloads) for readability

shy mauve
#

Ohh thanks I didnt found that in the docs sad

#

the new dogs is a little bit different

shy mauve
#

Okay I moved that now in the ready event

    async onReady({data: payload, api}) {
        console.log(`(GATEWAY) => Shard ${payload.shard.join(', ')} is ready`);

        if (GatewayManager.client) await GatewayManager.client.updatePresence(payload.shard[0], {
            since: 91879201,
            activities: [{
                name: 'We love casting spells | Memer.gg',
                type: ActivityType.Custom,
            }],
            status: PresenceUpdateStatus.Online,
            afk: false
        }).then(() => {
            console.log(`(GATEWAY) => Shard ${payload.shard[0]} presence updated`);
        });
    }

the promise gets resolved but still no status ?

fleet citrus
#

just to clarify, when you say status are you referring to a custom status? your activity?

shy mauve
#

I'm referring to the custom bot activity

fleet citrus
#

then that's also not the expected payload for a Custom type activity
the actual text of the status is determined by the state property
the name is required, but not displayed anywhere
you may be used to discord.js automatically setting the state to the name if not present
/core does not have this functionality

shy mauve
#

I see that explains it

#

thanks mate I try that