@dirain/client
TypeScript icon, indicating that this package has built-in type declarations

0.0.25 • Public • Published

@dirain/client

Node.js CI

About

@dirain/client is a very fragile Node.js dual module to you create bots with Pokémon Showdown API.

  • Written in TypeScript
  • Support ESModule & CommonJS
  • Fragile

Instlation

Node.js v16.9.0 or higher required.

npm i @dirain/client

Examle usage

Run npm i @dirain/client before execing file.

Getting all existing battle formats:

const { Client } = require("@dirain/client");

const client = new Client({});
let formats = {};

client.connect();

client.on("ready", () => {
    require("fs").writeFile("./formats.json", JSON.stringify(client.formats, null, 4), (err) => {
        if (err) throw err;
        console.log("Successfuly got a formats data!");
    });
});

Log into registered account:

const { Client } = require("@dirain/client");

const client = new Client({ name: "myAccountName", pass: "thisIsMyRealPassWord", autoJoin: ["botdevelopment"] });

client.connect();

client.on("ready", () => console.log("Logged in as ", client.user.name));

client.on("messageCreate", (message) => {
    if (message.content === "ping") message.reply("Pong!");
});

With TypeScript:

import { Client } from "@dirain/client";

const client = new Client({ name: "My account ~", "NotRealPassL0L", autoJoin: ["botdevelopment"] });

client.connect();

client.on("ready", () => console.log("Logged in as ", client.user!.name);

client.on("messageCreate", (message) => {
    if (message.author.id === client.status.id) return;

    if (message.content === "ping") message.reply("Pong!");
});

Readme

Keywords

none

Package Sidebar

Install

npm i @dirain/client

Weekly Downloads

1

Version

0.0.25

License

MIT

Unpacked Size

2.19 MB

Total Files

142

Last publish

Collaborators

  • dirain