2.0.0 • Published 3 years ago
kinemare.js v2.0.0
Kinemare.js
Kinemare.js is an API to create Kinemare Chat bots
Setup:
const kinemare = require("kinemare.js");
kinemare.login({ email: "", password: "" });
Comment:
const comment = await kinemare.comment({ post: "post ID", message: "My comment" });
//This returns an object of the comment
Post:
const post = await kinemare.post({ message: "My post" });
//This returns an object of the post
Send message in global chat:
const post = await kinemare.message({ message: "My post" });
//This returns an object of the post
Listen on when someone made a post:
kinemare.event("post", async post => {
if (post.post.includes("kinemare.js")) {
const post = await kinemare.comment({ post: post.postId, message: "Check out kinemare.js on npmjs.com" });
} else if (post.postId === "1234567898765") {
const comment = await kinemare.comment({ post: post.postId, message: "Commented on specific post" });
}
//On post event you can use: post.postId, post, authorId, authorName, authorAvatar, createdAt
});
Listen on when someone made a comment:
kinemare.event("comment", async comment => {
if (comment.comment.includes("kinemare.js")) {
const comment = await kinemare.comment({ post: comment.postId, message: "Check out kinemare.js on npmjs.com" });
//On comment event you can use: comment.commentId, postId, comment, authorId, authorName, authorAvatar, createdAt
}
});
Listen on when someone has messaged in global chat:
kinemare.event("message", async message => {
if (message.content.includes("kinemare.js")) {
const message = await kinemare.message({ message: "Check out this api" });
//On message event you can use: message.authorName, message.content, message.authorAvatar
}
});
Send an embed message (ONLY WORKS ON REALTIME CHAT)
const embed = {
description: "Check out this cool api",
color: "HEX Color (Optional)",
thumbnail: "Image URL (Optional)",
};
const message = await kinemare.message({ embed: embed });
Send a message with link button(s) (ONLY WORKS ON EMBED (for now))
const embed = {
description: "Check out this cool api",
color: "HEX Color (Optional)",
thumbnail: "Image URL (Optional)",
};
const button1 = {
label: "API Link",
link: "https://www.npmjs.com/package/kinemare.js",
color: "HEX Color",
textColor: "HEX Color",
};
const button2 = {
label: "Website",
color: "HEX Color",
link: "https://www.kinemare.com",
textColor: "HEX Color",
};
const message = await kinemare.message({ embed: embed, buttons: [button1, button2] });
Listen to button click (MUST NOT HAVE link: "")
kinemare.event("button", async button => {
if (button.label === "API") {
const message = await kinemare.message({ message: "https://www.npmjs.com/package/kinemare.js" });
}
//On button event you can use: button.label, content, authorAvatar, authorName, color
});
You might have to install node-fetch v2.6.1 if it wont work!
How to install
npm i node-fetch@2.6.1