Deathnote custom message, tags implementation

master
Kit Kasune 4 years ago
parent 118d6cf647
commit 82d83a38eb
  1. 5
      commands/deathnote.js
  2. 19
      util/test.js

@ -1,5 +1,7 @@
const Discord = require('discord.js'); const Discord = require('discord.js');
const moment = require('moment'); const moment = require('moment');
const {Tag} = require('../util/tag');
const {TagFilter} = require('../util/tagfilter');
const deaths = [ const deaths = [
"watching too much anime", "an overdose of waifus", "Hypotakunemia", "trying to self-isekai", "watching too much anime", "an overdose of waifus", "Hypotakunemia", "trying to self-isekai",
@ -66,6 +68,9 @@ module.exports = {
let title = reptype.titles[Math.floor(Math.random() * reptype.titles.length)]; let title = reptype.titles[Math.floor(Math.random() * reptype.titles.length)];
let pretext = before[Math.floor(Math.random() * before.length)]; let pretext = before[Math.floor(Math.random() * before.length)];
let options = new TagFilter([new Tag(['method', '-m', 'cause', '-c'], 'method', 'append')]).test(args.splice(0, 1).join(" "));
if (options.method.length) {death = options.method;}
let victim = message.mentions.members.first(); let victim = message.mentions.members.first();
let killer = message.member; let killer = message.member;

@ -1,19 +0,0 @@
const {Tag} = require('./tag');
const {TagFilter} = require('./tagfilter');
let myATag = new Tag(["-name", "-n"], "name", "append");
let myTTag = new Tag(["force"], "force", "toggle");
myTTag.addTrigger('f');
console.log(myATag);
console.log(myTTag);
let myFilter = new TagFilter([myATag, myTTag]);
console.log(myFilter);
console.log(myFilter.test("create -n jacob clark -f"));
console.log(new TagFilter([
new Tag(['-reason', '-r'], 'reason', 'append'),
new Tag(['-against', '-a'], 'against', 'append'),
new Tag(['-force', '-f'], 'force', 'toggle')
]).test('d6 d6 d10 -r to suffer -against myself -f'));
Loading…
Cancel
Save