All Projects → plugCubed → Plugapi

plugCubed / Plugapi

Licence: mit
A generic API for creating plug.dj bots

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Plugapi

Popuko
A helpful operation bot for GitHub. This helps to assign a reviewer, to merge a pull request, and to notify an unmergeable pull request with a comment as a command interactively.
Stars: ✭ 75 (-9.64%)
Mutual labels:  bot
Noisy
Simple random DNS, HTTP/S internet traffic noise generator
Stars: ✭ 1,208 (+1355.42%)
Mutual labels:  bot
Spam Bot 3000
Social media research and promotion, semi-autonomous CLI bot
Stars: ✭ 79 (-4.82%)
Mutual labels:  bot
Lua Mirai
基于mirai-core api的lua快速开发框架。
Stars: ✭ 77 (-7.23%)
Mutual labels:  bot
Invite Manager
This bot will show who invited who. It's recording and showing the total count of invitations of an user, how many of them left, etc.
Stars: ✭ 77 (-7.23%)
Mutual labels:  bot
Speechbot
A Text-to-Speech Python Telegram bot
Stars: ✭ 78 (-6.02%)
Mutual labels:  bot
Botauth
Authentication middleware for the botframework
Stars: ✭ 74 (-10.84%)
Mutual labels:  bot
Thetagang
ThetaGang is an IBKR bot for collecting money
Stars: ✭ 1,231 (+1383.13%)
Mutual labels:  bot
Nonebot
基于 OneBot 标准的 Python 异步 QQ 机器人框架
Stars: ✭ 1,207 (+1354.22%)
Mutual labels:  bot
Ichunqiu qqbot
i春秋社区机器人自2018年02月04日开始服务于i春秋社区,每日文章推送、文章查询、魔法币查询、作者信息查询、作家团奖金余额查询、奖金排行榜、i春秋课程查询等一列功能。据不完全统计,使用人数已经超过3.5万,使用次数达到20万,最大覆盖700+个群。
Stars: ✭ 79 (-4.82%)
Mutual labels:  bot
Luna
An adorable Discord.js bot. Free, Open Source and Cross Platform, usable as a solid base for larger projects. Written in NodeJs.
Stars: ✭ 76 (-8.43%)
Mutual labels:  bot
Line Bot Sdk Python
LINE Messaging API SDK for Python
Stars: ✭ 1,198 (+1343.37%)
Mutual labels:  bot
Unfollow Plus
Automated Instagram Unfollower Bot
Stars: ✭ 79 (-4.82%)
Mutual labels:  bot
Botframework Webchat
A highly-customizable web-based client for Azure Bot Services.
Stars: ✭ 1,198 (+1343.37%)
Mutual labels:  bot
Slacky
🐍 The BEST Slack Selfbot on GitHub | No Bot User, Acts Like It's You! ⭐️
Stars: ✭ 80 (-3.61%)
Mutual labels:  bot
Kik Bot Api Unofficial
Python API for writing unoffical Kik bots that act like humans
Stars: ✭ 75 (-9.64%)
Mutual labels:  bot
Misaki
Misaki is Discord Bot designed for communities with commands ranging from gif based anime reactions, to head scratching trivia commands.
Stars: ✭ 78 (-6.02%)
Mutual labels:  bot
Is Google
Verify that a request is from Google crawlers using Google's DNS verification steps
Stars: ✭ 82 (-1.2%)
Mutual labels:  bot
Nino
🔨 Advanced and cute moderation discord bot as an entry of Discord's Hack Week!
Stars: ✭ 78 (-6.02%)
Mutual labels:  bot
Bot
A Discord bot for all your needs. With memes, utilities, moderation & more, Fire is the only bot you'll need.
Stars: ✭ 79 (-4.82%)
Mutual labels:  bot

plugAPI Build Status npm version npm downloads NPM David Discord Server

About

A generic NodeJS API for creating plug.dj bots.

Originally by Chris Vickery, now maintained by TAT and The plug³ Team.

How to use

Run the following:

npm install plugapi

You can choose to instantiate plugAPI with either Sync or Async:

Sync:

const PlugAPI = require('plugapi');
const bot = new PlugAPI({
    email: '',
    password: ''
});

bot.connect('roomslug'); // The part after https://plug.dj

bot.on(PlugAPI.events.ROOM_JOIN, (room) => {
    console.log(`Joined ${room}`);
});

Async:

const PlugAPI = require('plugapi');

new PlugAPI({
    email: '',
    password: ''
}, (err, bot) => {
    if (!err) {
        bot.connect('roomslug'); // The part after https://plug.dj

        bot.on(PlugAPI.events.ROOM_JOIN, (room) => {
            console.log(`Joined ${room}`);
        });
    } else {
        console.log(`Error initializing plugAPI: ${err}`);
    }
});

New features in V5.0.0

Guest login is now possible if no userdata is passed into plugAPI or guest is set to true

Guest:

const PlugAPI = require('plugapi');
const bot = new PlugAPI();
// OR
const bot = new PlugAPI({
    guest: true
});

Facebook login is now possible. Easiest way to obtain the Access Token and user ID is to login via fb on plug and view the request data.

Facebook:

const PlugAPI = require('plugapi');
const bot = new PlugAPI({
    facebook: {
        accessToken: 'xxxxxxxx',
        userID: 'xxxxxxxx'
    }
});

PlugAPI now uses tough-cookie to store cookies. Refer to the wiki for more information.


Examples

Here are some bots that are using this API.

Botname Room
AuntJackie Mix-N-Mash
BotX NightCore Fanclub
BeavisBot I <3 the 80's and 90's
brainbot 5M4R7
Charlotte Youtunes
-DnB- Drum & Bass
DRPG Discord Dungeons
Ekko EDT
F!shtank SWaQ Hanger
FlavorBar Flavorz
FoxBot Approaching Nirvana
Holly Refbots Connect The Songs (Read Info!)
KawaiiBot AnimeMusic
prehibicja [PL] Prohibicja.xyz ANY GENRE
QBot EDM Qluster
Skynet Cubed PlugCubed
TFLBot The F**k Off Lounge | TFL
Toaster-chan ☆ ♥ Nightcore-331 ♥ ☆
Have a bot that uses the API? Let us know!

EventListener

You can listen on essentially any event that plug emits.

// basic chat handler to show incoming chats formatted nicely
bot.on(PlugAPI.events.CHAT, (data) => {
    if (data.type === 'emote') {
        console.log(data.from + data.message);
    } else {`
        console.log(`${data.from} > ${ data.message}`);
    }
});

Here's an example for automatic reconnecting on errors / close events

const reconnect = () => { bot.connect(ROOM); };

bot.on('close', reconnect);
bot.on('error', reconnect);

API Documentation

For V4 documentation, the Wiki is the best resource.

For V5 documentation, please refer to the Docs for documentation on methods and events. The documentation is written in JSDoc in the respective files found in the lib/ folder. If there are changes to be made, edit the JSDoc and run the followng command:

npm run docs

Submit a pull request and wait for review


Contribute

  1. Clone repository to an empty folder.
  2. CD to the folder containing the repository.
  3. Run npm install to set up the environment.
  4. Edit your changes in the code, and make sure it follows our codestyle.
  5. Run npm test to make sure all tests pass.
  6. After it's bug free, you may submit it as a Pull Request to this repository.

Misc Options

Multi line chat

Since plug.dj cuts off chat messages at 250 characters, you can choose to have your bot split up chat messages into multiple lines.

Delete Message Blocks

With how plug currently works, deleting messages deletes the entire group of messages from the same user. Set this option to disallow that.

Delete All Chat

PlugAPI mimics plug's behavior in disallowing deletion of chat of users above the bot's rank. Setting this option to true will bypass that check.

var bot = new PlugAPI(auth);
bot.deleteMessageBlocks = false; //set to true if you want the bot to not delete grouped messages. Default is false.
bot.deleteAllChat = false; // Set to true to enable deletion of chat regardless of role . Default is false
bot.multiLine = true; // Set to true to enable multi line chat. Default is false
bot.multiLineLimit = 5; // Set to the maximum number of lines the bot should split messages up into. Any text beyond this number will just be omitted. Default is 5.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].