forked from Supositware/Haha-Yes
added blacklist system and log what people send and by who
This commit is contained in:
parent
44d5444e81
commit
09399db976
2 changed files with 21 additions and 12 deletions
|
@ -1,13 +1,16 @@
|
||||||
const { Command } = require('discord-akairo');
|
const { Command } = require('discord-akairo');
|
||||||
const Twitter = require('twitter-lite');
|
const Twitter = require('twitter-lite');
|
||||||
const rand = require('../../rand.js');
|
const rand = require('../../rand.js');
|
||||||
const { twiConsumer, twiConsumerSecret, twiToken, twiTokenSecret } = require('../../config.json');
|
const { twiConsumer, twiConsumerSecret, twiToken, twiTokenSecret, twiChannel } = require('../../config.json');
|
||||||
|
const blacklist = require('../../json/twiBlacklist.json');
|
||||||
|
|
||||||
class tweetCommand extends Command {
|
class tweetCommand extends Command {
|
||||||
constructor() {
|
constructor() {
|
||||||
super('tweet', {
|
super('tweet', {
|
||||||
aliases: ['tweet'],
|
aliases: ['tweet'],
|
||||||
category: 'general',
|
category: 'general',
|
||||||
|
cooldown: 86400,
|
||||||
|
ratelimit: 2,
|
||||||
args: [
|
args: [
|
||||||
{
|
{
|
||||||
id: 'text',
|
id: 'text',
|
||||||
|
@ -24,27 +27,29 @@ class tweetCommand extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
async exec(message, args) {
|
async exec(message, args) {
|
||||||
|
const channel = this.client.channels.get(twiChannel);
|
||||||
|
|
||||||
|
if (blacklist.includes(message.author.id)) {
|
||||||
|
return message.channel.send('You have been blacklisted from this command... be less naughty next time.');
|
||||||
|
}
|
||||||
|
|
||||||
let text = args.text;
|
let text = args.text;
|
||||||
if (!text)
|
if (!text)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//Basic filter, hopefully i wont get banned from twitter
|
//Basic filter, hopefully i wont get banned from twitter
|
||||||
text = text.replace(/n[\w\W]+gg[\w\W]+|f[aA\W*-_0-9]gg[\w\W]+|f[aA\W*-_0-9]g|kys/gi, '❤');
|
text = text.replace(/n[\w\W]+gg[\w\W]+|f[aA\W*-_0-9]gg[\w\W]+|f[aA\W*-_0-9]g|kys/gi, '❤');
|
||||||
console.log(text);
|
|
||||||
|
|
||||||
|
|
||||||
text = rand.random(text, message);
|
text = rand.random(text, message);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let client = new Twitter({
|
|
||||||
consumer_key: twiConsumer,
|
|
||||||
consumer_secret: twiConsumerSecret,
|
|
||||||
access_token_key: twiToken,
|
|
||||||
access_token_secret: twiTokenSecret
|
|
||||||
});
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
let client = new Twitter({
|
||||||
|
consumer_key: twiConsumer,
|
||||||
|
consumer_secret: twiConsumerSecret,
|
||||||
|
access_token_key: twiToken,
|
||||||
|
access_token_secret: twiTokenSecret
|
||||||
|
});
|
||||||
|
|
||||||
const response = await client.post('statuses/update', {
|
const response = await client.post('statuses/update', {
|
||||||
status: text
|
status: text
|
||||||
});
|
});
|
||||||
|
@ -52,6 +57,9 @@ class tweetCommand extends Command {
|
||||||
const tweetid = response.id_str;
|
const tweetid = response.id_str;
|
||||||
|
|
||||||
// Send the final text
|
// Send the final text
|
||||||
|
|
||||||
|
channel.send(`AUTHOR: ${message.author.username} (${message.author.id}) Sent: ${text}`);
|
||||||
|
|
||||||
return message.channel.send(`Go see ur epic tweet https://twitter.com/HahaYesDB/status/${tweetid}`);
|
return message.channel.send(`Go see ur epic tweet https://twitter.com/HahaYesDB/status/${tweetid}`);
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|
1
json/twiBlacklist.json
Normal file
1
json/twiBlacklist.json
Normal file
|
@ -0,0 +1 @@
|
||||||
|
[]
|
Loading…
Reference in a new issue