From d77c4ea8912d94fcdb30fe0110992570336165d9 Mon Sep 17 00:00:00 2001 From: shinchanOP <67926590+shinchanOP@users.noreply.github.com> Date: Mon, 3 May 2021 15:45:41 +0530 Subject: [PATCH] Add files via upload --- docs/Welcome/started.md | 23 +++++++++++++++++++++++ docs/Welcome/welcome.md | 22 ++++++++++++++++++++++ docs/examples/examplebot.js | 34 ++++++++++++++++++++++++++++++++++ docs/index.yml | 10 ++++++++++ 4 files changed, 89 insertions(+) create mode 100644 docs/Welcome/started.md create mode 100644 docs/Welcome/welcome.md create mode 100644 docs/examples/examplebot.js create mode 100644 docs/index.yml diff --git a/docs/Welcome/started.md b/docs/Welcome/started.md new file mode 100644 index 0000000..59700b3 --- /dev/null +++ b/docs/Welcome/started.md @@ -0,0 +1,23 @@ +# Documentation + +Memer-API is a powerful module that allows you to manipulate images very easily. + + +## Install the Api-Module: +```npm install memer=api``` + +## Use the Api-Module +``` +const Meme = require("memer-api"); +const memer = new Meme(); + + +//Little Example: +const avatar = "https://imgur.com/I5DmdNR.png"; //only static images +memer.dab(avatar).then(image => { + //now you have a "BUFFER", for Discord create an attachment + //const attachment = new Discord.MessageAttachment(image, "dab.png"); + //.send(attachment) +}) +``` + diff --git a/docs/Welcome/welcome.md b/docs/Welcome/welcome.md new file mode 100644 index 0000000..1e8c170 --- /dev/null +++ b/docs/Welcome/welcome.md @@ -0,0 +1,22 @@ +# Memer Api - Welcome + +Memer API is a powerful module that allows you to manipulate images very easily. + + +## **Installation** + +Get in touch with memer-api, really fast and easy: + +``` +npm install memer-api +``` + +## First Use - with NODEJS + +Once you installed the package, simply add it to your javascript File. Here an Example for nodejs + +``` +const Meme = require("memer-api"); +const memer = new Meme(); +memer.(); //returns -> Promise -> +``` \ No newline at end of file diff --git a/docs/examples/examplebot.js b/docs/examples/examplebot.js new file mode 100644 index 0000000..b29525c --- /dev/null +++ b/docs/examples/examplebot.js @@ -0,0 +1,34 @@ +//Import the Module directly, as with an forc ;) as well as discord.js and create a new client for discord bot & memer Bot +const Meme = require("meme-api"), + Discord = require("discord.js"), + client = new Discord.Client(), + memer = new Meme(); + +//login to the Discord Bot +client.login("YOUR DISCORD BOT TOKEN GOES HERE"); + +//Read Event +client.on("ready", () => { + console.log("Memer is online!"); // eslint-disable-line no-console +}); + +//Log Message +client.on("message", (message) => { + //if in a dm or msg from a bot, return + if (!message.guild || message.author.bot) return; + + const args = message.content.slice("!".length).split(" "); + const cmd = args.shift().toLowerCase(); + //Example Command useage: !abandon + if (cmd === "abandon") { + if(!args[0]) return message.reply("Unknown useage, try this: `!abandon `"); + //create image and send it in the channel with the added arguments to the command + memer.abandon(args.join(" ")).then(image => { + const attachment = new Discord.MessageAttachment(image, "abandon.png"); + return message.channel.send(attachment); + }).catch(e => { + message.channel.send(String(e).substr(0, 2000), {code: "js"}) + }) + } + +}); \ No newline at end of file diff --git a/docs/index.yml b/docs/index.yml new file mode 100644 index 0000000..60aa90c --- /dev/null +++ b/docs/index.yml @@ -0,0 +1,10 @@ +- name: Welcome + files: + - name: General + path: welcome.md + - name: Getting started + path: started.md +- name: Examples + files: + - name: Example + path: examplebot.js