matttang27 / MatthewBot2

Matthew's 2nd rendition of Matthew Bot.
1 stars 0 forks source link

UserBots are causing user id's to return boolean #1

Closed matttang27 closed 4 months ago

matttang27 commented 4 months ago

When using UserBots to simulate commands, they sometimes cause the Client to change the user's id to false (and itself to true).

image

I suspect it may be some issue with Collectors, as the problem only appears when they are created. However, I have no explanation as to why it only breaks with UserBots and not manual testing.

It seems that the ids break until the bot is restarted - deleting Users from the cache and re-fetching them do not work.

It doesn't appear to be any "timing" issue - even after waiting for 5 secs before each button press, error still appears.

When testing the game function, the ids work up to the commented point. However, when the "1" and "7" inputs are sent using sendMessage, it breaks. Somehow, manually typing in 1 and 7 in the chrome client works.

Actually, even if the "1" input is sent with sendMessage, manually typing 7 works, while sendMessage does not.

`

const { l } = require("@root/emojiCharacters"); const client = new MatthewClient(config, true); const UserBot = require("@userBot"); const setup = require("@testSetup"); const BOT_COUNT = 2;

(async () => { bots = await setup(client, BOT_COUNT); client.testChannel = await client.testGuild.channels.fetch("720351714791915523")

bots.forEach((bot) => (bot.channelId = client.testChannel.id));
await bots[0].sendCommand("testgame", "MatthewBot2");

response = await client.waitForMessage({
    embeds: [{ data: { title: "game game created!  [1/4]" } }],
    components: [{ components: [{}, {}, {}] }],
});

await bots[1].clickButton("Join / Leave", response);

response = await client.waitForMessage({
    embeds: [{ data: { title: "game game created!  [2/4]" } }],
    components: true,
});

await bots[0].clickButton("Start", response);

response = await client.waitForMessage({
    embeds: [{ data: { title: "Options" } }],
    components: true,
});

await new Promise((r) => setTimeout(r,5000))

await bots[0].sendMessage("1");

response = await client.waitForMessage({
    embeds: [{ data: { title: "Editing example" } }],
    components: true,
});

await new Promise((r) => setTimeout(r,5000))

/*

await bots[0].sendMessage("7");

response = await client.waitForMessage({
    embeds: [{ data: { title: "Options" } }],
    components: true,
});

await new Promise((r) => setTimeout(r,5000))

await bots[0].clickButton("Continue", response);

response = await client.waitForMessage({
    embeds: [{ data: { title: "We have a winner!" } }],
    components: true,
});
*/

})();

`

??????

await bots[0].sendMessage("7") DOES NOT AFFECT THE CLIENT IN ANY WAY???? IT IS JUST A PUPPETEER SCRIPT?

matttang27 commented 4 months ago

d5916a4

FOUND THE PROBLEM IT WAS A MISSING = SIGN CAUSING CREATEDFUNC TO ASSIGN TRUE TO THE USERID.

Assigning false for userbots might mean that the getuserid might not be working properly...