es6 native

This commit is contained in:
Flummi
2017-12-04 12:22:53 +01:00
parent f6f882586b
commit 6d5b33bed4
42 changed files with 149 additions and 131 deletions

View File

@ -1,4 +1,4 @@
import { read, write, cfg } from "../cfg.js";
import { read, write, cfg } from "../cfg";
const _modes = ["get", "set", "rm", "add", "opts"];
const _opts = {
@ -7,7 +7,7 @@ const _opts = {
};
const _debug = false;
module.exports = bot => {
export default bot => {
bot._trigger.set("cfg", new bot.trigger({
call: /^\!cfg/i,
level: 100,

View File

@ -1,4 +1,4 @@
const rp = require("request-promise");
import rp from "request-promise";
const api_url = ({ market, crypto, currency }) => `https://api.cryptowat.ch/markets/${market}/${crypto}${currency}/summary`;
const currencies = {
@ -14,7 +14,7 @@ const markets = {
xmr: "bitfinex"
};
module.exports = bot => {
export default bot => {
bot._trigger.set("coins", new bot.trigger({
call: /^(\.|\/)(btc|eth|xmr)/i,
f: e => {

View File

@ -1,7 +1,7 @@
import sql from "../sql.js";
import { getLevel, loadAdmins } from "../admin.js";
import sql from "../sql";
import { getLevel, loadAdmins } from "../admin";
module.exports = bot => {
export default bot => {
bot._trigger.set("join", new bot.trigger({
call: /^\!join .*/i,
level: 100,

View File

@ -1,6 +1,6 @@
import { admins, getLevel } from "../admin.js";
import { admins, getLevel } from "../admin";
const vm = require("vm");
import vm from "vm";
let maxoutput = 750;
let context = vm.createContext({
@ -8,7 +8,7 @@ let context = vm.createContext({
bot: null,
admins: null,
});
module.exports = bot => {
export default bot => {
bot._trigger.set("sandbox_debug", new bot.trigger({
call: /^\!debug (.*)/i,
level: 100,

View File

@ -1,4 +1,4 @@
import sql from "../sql.js";
import sql from "../sql";
const data = {
dope_actions: {},
@ -12,7 +12,7 @@ Object.keys(data).forEach(cur => {
});
});
module.exports = bot => {
export default bot => {
bot._trigger.set("dope", new bot.trigger({
call: /^(\.|\/)dope/i,
f: e => {

View File

@ -1,8 +1,8 @@
const rp = require("request-promise");
import rp from "request-promise";
const feed = "https://www.kernel.org/releases.json";
module.exports = bot => {
export default bot => {
bot._trigger.set("kernel", new bot.trigger({
call: /^(\.|\/)kernel/i,
f: e => {

View File

@ -1,5 +1,5 @@
const rp = require("request-promise")
, fs = require("fs");
import rp from "request-promise";
import fs from "fs";
const maxoutput = 500;

22
src/inc/trigger/main.mjs Normal file
View File

@ -0,0 +1,22 @@
import cfg from "./cfg";
import coins from "./coins";
import core from "./core";
import debug from "./debug";
import drugs from "./drugs";
import kernel from "./kernel";
import mcmaniac from "./mcmaniac";
import parser from "./parser";
import quotes from "./quotes";
import rape from "./rape";
import sandbox from "./sandbox";
import urban from "./urban";
import nxy from "./useless_nxy";
import uwe from "./useless_uwe";
import wttr from "./wttr";
export default [
cfg, coins, core, debug,
drugs, kernel, mcmaniac,
parser, quotes, rape, sandbox,
urban, nxy, uwe, wttr
];

View File

@ -1,4 +1,4 @@
import sql from "../sql.js";
import sql from "../sql";
let _query_get = `
select item,
@ -12,7 +12,7 @@ let _query_add = `
insert into mcmaniacs (item) values ($1) on conflict do nothing
`;
module.exports = bot => {
export default bot => {
bot._trigger.set("mcmaniac_add", new bot.trigger({
call: /Mc.*iaC/,
active: true,

View File

@ -1,5 +1,5 @@
const fs = require("fs")
, ytdl = require("ytdl-core");
import fs from "fs";
import ytdl from "ytdl-core";
const _args = [
"--no-progress",
@ -11,7 +11,7 @@ const _args = [
];
module.exports = bot => {
export default bot => {
bot._trigger.set("parser", new bot.trigger({
call: /https?:\/\/[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?/gi,
active: false,

View File

@ -1,4 +1,4 @@
import sql from "../sql.js";
import sql from "../sql";
let _query_get = `
with ranked_quotes as (
@ -22,7 +22,7 @@ insert into nxy_quotes
($1, $2, $3, $4);
`;
module.exports = bot => {
export default bot => {
bot._trigger.set("quotes", new bot.trigger({
call: /^(\.|\/)q .*/i,
active: true,

View File

@ -1,6 +1,6 @@
import sql from "../sql.js";
import sql from "../sql";
module.exports = bot => {
export default bot => {
bot._trigger.set("rape", new bot.trigger({
call: /^(\.|\/)rape/i,
f: e => {

View File

@ -1,9 +1,9 @@
import sql from "../sql.js";
import { maxoutput, sandbox, bfgen } from "./lib/sandbox.js";
import sql from "../sql";
import { maxoutput, sandbox, bfgen } from "./lib/sandbox";
const vm = require("vm")
, rp = require("request-promise")
, stringify = require("stringify-object");
import vm from "vm";
import rp from "request-promise";
import stringify from "stringify-object";
let _contexts = new Map();
sql.any("select data from useless where trigger = 'sandbox_js'")
@ -14,7 +14,7 @@ sql.any("select data from useless where trigger = 'sandbox_js'")
console.log("nichts vorhanden lol", err);
});
module.exports = bot => {
export default bot => {
bot._trigger.set("sandbox_js", new bot.trigger({
call: /^\!js (.*)/i,
f: e => {

View File

@ -1,8 +1,8 @@
const rp = require("request-promise");
import rp from "request-promise";
const url = "https://api.urbandictionary.com/v0/define"
module.exports = bot => {
export default bot => {
bot._trigger.set("urbandict", new bot.trigger({
call: /^(\.|\/)ud .*/i,
f: e => {

View File

@ -1,6 +1,5 @@
import sql from "../sql.js";
const rp = require("request-promise");
import sql from "../sql";
import rp from "request-promise";
const data = {
yiff: [],
@ -21,7 +20,7 @@ Object.keys(data).forEach(cur => {
});
});
module.exports = bot => {
export default bot => {
bot._trigger.set("kiss", new bot.trigger({
call: /^(\.|\/)kiss/i,
f: e => {

View File

@ -1,6 +1,7 @@
import sql from "../sql.js";
const rp = require("request-promise")
, jsdom = require("jsdom").JSDOM;
import sql from "../sql";
import rp from "request-promise";
import JSDOM from "jsdom";
const data = {
abschieben: [],
@ -19,7 +20,7 @@ Object.keys(data).forEach(cur => {
});
});
module.exports = bot => {
export default bot => {
bot._trigger.set("abschieben", new bot.trigger({
call: /^(\.|\/)abschieben/i,
f: e => {

View File

@ -1,6 +1,6 @@
const rp = require("request-promise");
import rp from "request-promise";
module.exports = bot => {
export default bot => {
bot._trigger.set("wttr", new bot.trigger({
call: /^\.wttr .*/i,
clients: ["irc"],