Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Yash094 authored May 3, 2021
1 parent 1466cc3 commit d77c4ea
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docs/Welcome/started.md
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)
})
```

22 changes: 22 additions & 0 deletions docs/Welcome/welcome.md
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>
```
34 changes: 34 additions & 0 deletions docs/examples/examplebot.js
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"})
})
}

});
10 changes: 10 additions & 0 deletions docs/index.yml
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

0 comments on commit d77c4ea

Please sign in to comment.