reconlx-palaexpress

1.0.0 • Public • Published

Traduction

Ce module n'est que la traduction française du jeu de morpion du module reconlx de reconlx.

❔ reconlx

A simple api to configure and enhance the ways on coding your discord bot. Compatible with discord.js v12 but it should also work on older versions. Variety of different usages for this api.

NPM info


📝 Table of contents


Installation

First install Node.js. Then:

$ npm install reconlx

🛠 Usages (Click on it for more info on how to use it)

  • reconDB - simple way to store data into mongodb
  • DaysAgo - check how many days ago was it using date format
  • ReactionPages - simple pagination to make your "MessageEmbed" interactable.
  • Confirmation - A reaction collector which returns the first emoji collected, can be used as a confirmation prompt.
  • fetchTranscript - Specify an amount of messages and it will return a discord chat template with messages, acts like a transcript.
  • timeout - Makes it easier to delete messages according to your needs
  • chatBot - Replies to your messages in discord.
  • hangman - Hangman game now playable in discord.
  • tictactoe - TicTacToe game now playable in discord.
  • GiveawayClient - Giveaway Client, easy way to manage your giveaways
  • SnakeCord - Snakecord with some minor error fixes as the mantainer isn't reading prs.

✈ Importing

// Using Node.js `require()`
const recon = require("reconlx");

// Using ES6 imports
import recon from "reconlx";

🙋‍♂️ Support

Feel free to join the support discord server -> https://discord.gg/xCCpfth


🔧 Usages


DaysAgo

// Example on checking how long the member's account was created.
// Import the package
const recon = require("reconlx");
// Destructure the package
const daysAgo = recon.DaysAgo;
const discord = require("discord.js");

client.on("guildMemberAdd", async (member) => {
    console.log(daysAgo(member.user.createdAt)); // return days.
});

ReactionPages

Example :

// Example on checking how long the member's account was created.
// Import the package
const recon = require("reconlx");
// Destructure the package
const ReactionPages = recon.ReactionPages;
// Use either MessageEmbed or RichEmbed to make pages
// Keep in mind that Embeds should't have their footers set since the pagination method sets page info there
const { MessageEmbed } = require("discord.js");
const embed1 = new MessageEmbed().setTitle("1");
const embed2 = new MessageEmbed().setTitle("2");
// Create an array of embeds.
const pages = [embed1, embed2];
// Change pages when sending numbers.
const textPageChange = true;
// Create an emojilist, first emoji being page back and second emoji being page front. Defaults are set to  ['⏪', '⏩'].
const emojis = ["⏪", "⏩"];
// Define a time in ms, defaults are set to 60000ms which is 60 seconds. Time on how long you want the embed to be interactable
const time = 30000;
// Call the ReactionPages method, use the <message> parameter to initialize it.
ReactionPages(msg, pages, textPageChange, emojis, time);
//There you go, now you have embed pages.

Preview on a music list :

preview


confirmation

// destructure the package
const { confirmation } = require("reconlx");
// Here is an example on using it in banning members.
message.channel.send("Confirmation for banning members").then(async (msg) => {
    // parameters used(which msg to react on, who can acess it, reactions, time(optional))
    const emoji = await confirmation(msg, message.author, ["✅", "❌"], 30000);
    if (emoji === "✅") {
        //if author reacts on check
        //delete the confirmation message
        msg.delete();
        //ban the member
        guildMember.ban();
    }
    if (emoji === "❌") {
        // if author reacts on cross
        // delete the confirmation message
        msg.delete();
    }
});

fetchTranscript

// destructure the package
const { fetchTransript } = require("reconlx");

// here is how you use it

// template
// fetchTranscript(message: any, numberOfMessages: number, sendToAuthor: boolean)

// returns buffer

//example
module.exports = {
    name: "transcript",
    run: async (client, message) => {
        fetchTranscript(message, 5).then((data) => {
            const file = new MessageAttachment(data, "index.html");
            message.channel.send(file);
        });
    },
};
// it will fetch 5 messages in the current channel.

Preview on a general chat

preview


timeout

// destructure the package
const { timeout } = require("reconlx");

// example

const messageToDelete = await message.channel.send("Hello There 👋");

// using the method
// template => timeout(message: who can acess, msgToDelete: which message to delete,time: time before the emoji gets deleted)
timeout(message, messageToDelete, 5000); // only message.author can areact, messageToDelete is going to deleted if collected reactions, if no reactions after 5 seconds the reaction will be removed.

Preview

preview


chatBot

const { chatBot } = require("reconlx");

/** @parameters
 * message, message.channel
 * input, input to give
 */

// example

chatBot(message, args.join(" "));

Preview

preview


hangman

//importing
const { hangman } = require("reconlx");

// parameters
/**
 * @name hangman
 * @param {Object} options options
 * @param {String} [options.channelID] channel to send to (channel.id)
 * @param {any} [options.message] parameter used for message event
 * @param {String} [options.permission] required permission to use this command (optional); default set to everyone.
 * @param {String} [options.word] word that needed to be guessed
 * @param {any} [options.client] client used to defined Discord.Client
 */

// making hangman
const hang = new hangman({
    message: message,
    word: args.slice(1).join(" "),
    client: client,
    channelID: message.mentions.channels.first(),
});

// starting the game
hang.start();

Preview

preview

tictactoe

//importing
const { tictactoe } = require("reconlx");

// parameters
/**
 * @name tictactoe
 * @param {Object} options options
 * @param {any} [options.message] parameter used for message event
 * @param {any} [options.player_two] second player in the game.
 */

// start the game

var game = new tictactoe({
    message: message,
    player_two: message.mentions.members.first(),
});

Preview

preview




reconDB

1. Importing the package

const { reconDB } = require("reconlx");
// or
import { reconDB } from "reconlx";

2. Establishing and exporting reconDB

const db = new reconDB({
    uri: "your mongodb connection string",
});

module.exports = db;

3. Example on using it

const db = require("./db.js"); // replace db.js with your file path to the setup of reconDB

db.set("numbers", "123");

Methods

.set

// saves data to database
db.set("key", "value");

.get

// gets value from key
db.get("key"); // returns => value

.has

// returns boolean
db.has("key"); // returns => true

.delete

// deletes data
db.delete("key");

// checking for data
db.has("key"); // returns => false

GiveawayClient

Initialising the client

const Discord = require('discord.js')
const client = new Discord.Client();
const { GiveawayClient } = require('reconlx');

  /**
   * @name GiveawayClient
   * @kind constructor
   * @param {Client} client
   * @param {Object} options Options
   * @param {String} [options.mongoURI] mongodb connection string
   * @param {String} [options.emoji] emoji for reaction (must be a unicode)
   * @param {String} [options.defaultColor] default colors for giveaway embeds
   * @description Initiating the giveaway client
   */

const giveaway = new GiveawayClient(client, {
  mongoURI?
  emoji?
  defaultColor?
});

module.exports = giveaway;

Methods

start

/**
 * @method
 * @param {Object} options options
 * @param {TextChannel} [options.channel] Channel for the giveaway to be in
 * @param {Number} [options.time] Duration of this giveaway
 * @param {User} [options.hostedBy] Person that hosted the giveaway
 * @param {String} [options.description] Description of the giveaway
 * @param {Number} [options.winners] Amount of winners for the giveaway
 * @param {String} [options.prize] Prize for the  giveaway
 */

end

/**
 * @method
 * @param {String} MessageID Message ID for the giveaway
 * @param {Boolean} getWinner Choose a winner?
 * @description End a giveaway, choose a winner (optional)
 */

reroll

/**
 * @method
 * @param {String} channel channel of the giveaway
 * @param {String} id message id
 * @param {Number} winners amount of winners
 * @description Change the winners for a giveaway!
 */

getCurrentGiveaways

/**
 * @method
 * @param {Boolean} activatedOnly display activated giveaways only?
 * @param {Boolean} all display giveaways of  all guilds?
 * @param {Message} message message if (all = false)
 * @description Get data on current giveaways hosted by the bot
 */

removeCachedGiveaways

/**
 * @method
 * @param {Boolean} all Get data from all guilds?
 * @param {String} guildID guild id if all=false
 * @description Removes (activated = false) giveaways
 */

Readme

Keywords

none

Package Sidebar

Install

npm i reconlx-palaexpress

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

74.3 kB

Total Files

21

Last publish

Collaborators

  • gaetan20