ThePooN / bancho.js

Interface with Bancho over IRC, made easy and reliable.
https://bancho.js.org
GNU General Public License v3.0
57 stars 6 forks source link

Juste pour accéder au beatmap osu! #30

Closed Bibou1494 closed 12 months ago

Bibou1494 commented 1 year ago

Bonjour(ou bonsoir) je voudrais de l'aide pour accéder au beatmap osu! car je voulais faire un random map request. J'ai fait une clé api si besoin. du coup pour savoir comment l'inclure voici mon code

const Banchojs = require("bancho.js");

const USERNAME = "username"
const PASSWORD = "IRC password"
const API = "api key"

const client = new Banchojs.BanchoClient({
  username: USERNAME,
  password: PASSWORD
});

const prefix = "!";

const startOsuBot = async () => {
  try {
    await client.connect();
    console.log("osu!Bancho Connected...");

    client.on("PM", async ({ message, user }) => {
      //Check if message was sent by ourselves
      if (user.ircUsername === USERNAME) return;

      //Check for message prefix
      if (message[0] !== "!") return;

      const command = message.split(" ")[0].toLowerCase();

      switch (command) {
                case prefix + "help":
          return await user.sendMessage(`All command are in [https://github.com/Bibou1494/BibouOsu-Bancho-Bot GitHub]`);
    });

  } catch (err) {
    console.error(err);
  }
};

startOsuBot();

Merci en avance. Au revoir.

ThePooN commented 12 months ago

Hey,

This library only interfaces with Bancho, osu!stable's chat and multi-player server component.

Fetching beatmaps is thus out-of-scope of this project. You can interface with APIv1 or APIv2 in order to fetch beatmaps. APIv1 is easier and probably fits your needs. You can fetch data using simple HTTP requests or use a library like nodesu.

If you need any support, feel free to join my Discord server and visit #banchojs.

Bibou1494 commented 12 months ago

Ok thanks anyway