lol-discord

0.2.2 • Public • Published

LoL Discord

League of Legends Match History for Discord Bot

About

lol-discord is node.js module that make Discord embed message for League of Legends match history.

capture

Installation

Discord.js v12 is recommended.

npm install lol-discord

Usage

Import Package

const lol = require('lol-discord');

Set Language

lol.SetLanguage("ko");
// en or ko
// Default: ko

Set Locale

lol.SetLocale("kr");
// LOCALE: ['kr', 'br1', 'eun1', 'euw1', 'jp1', 'la1', 'la2', 'na1', 'oc1', 'tr1', 'tr1', 'ru']
// Default: kr

Search Summoner

lol.Search("hide on bush").then(embed_msg => {
          msg.reply({embed: embed_msg});
      }).catch(err => {
          msg.reply(err);
      });

Example

const lol = require('lol-discord');
    ...
client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
  lol.SetLanguage("ko");
  lol.SetLocale("kr");
});

client.on('message', msg => {
  if (msg.content === 'ping') {
    msg.reply('pong');
  }

  if(msg.content[0] == '롤' && msg.content.length > 2 && msg.content.length < 20) {
    summoner = msg.content.slice(2);
    /** Send Searching message */
    msg.reply("\""+summoner+"\" 검색중...").then(msg_searching => {
      /** Call "lol(summoner name)" */
      lol.Search(summoner).then(embed_msg => {
          /** If User Exist, embed message is generated */
          msg_searching.delete();
          msg.reply({embed: embed_msg});
      }).catch(err => {
          /** If User Not Exist or Error occur, Error message is generated */
          msg_searching.delete();
          msg.reply(err);
      });
    });
  }
});

Links

Package Sidebar

Install

npm i lol-discord

Weekly Downloads

11

Version

0.2.2

License

MIT

Unpacked Size

21.4 kB

Total Files

7

Last publish

Collaborators

  • unionyy