-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"); | ||
//<Channel>.send(attachment) | ||
}) | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.<Method>(<Options>); //returns -> Promise -> <Buffer> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <TEXT> | ||
if (cmd === "abandon") { | ||
if(!args[0]) return message.reply("Unknown useage, try this: `!abandon <TEXT>`"); | ||
//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"}) | ||
}) | ||
} | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |