Closed nzxl101 closed 1 year ago
This snippet is working fine here:
import { BanchoClient } from "bancho.js";
const client = new BanchoClient({
username: "ThePooN",
password: "REDACTED",
apiKey: "REDACTED"
});
client.connect().then(async () => {
// Send "!stats ThePooN" to BanchoBot
const user = await client.getUserById(3);
user.sendMessage("!stats ThePooN");
console.log(`Sent message to ${user.ircUsername}!`);
});
Upon executing this, I get my stats back from BanchoBot in my own IRC client, indicating that bancho.js successfully sent "!stats ThePooN" to user id 3 (being BanchoBot).
Please post a complete snippet for further assistance
bancho.banchoClient.getUserById(...).sendMessage is not a function because getUserById(...) returns a promise, not a banchouser object
My bad. I've fixed it with:
(await bancho.banchoClient.getUserById(19012828)).sendMessage("Yo");
Thanks @kiwec Maybe I shouldn't code stuff at 4am. lol
getUserById() doesn't return a valid class I'm not sure if this is easily fixable since it's dependent on
nodesu
but it would be nice :)I'm using this workaround for now