forked from Lea/obama-bot
yes
This commit is contained in:
parent
53d36787fd
commit
9ea38b2652
3
index.js
3
index.js
|
@ -28,9 +28,10 @@ client.once('ready', () => {
|
||||||
console.log('Logged in as ' + client.user.username);
|
console.log('Logged in as ' + client.user.username);
|
||||||
client.user.setActivity(`hamborger`, {type: "STREAMING", url: "https://www.youtube.com/watch?v=sHwvUFjaNdU"});
|
client.user.setActivity(`hamborger`, {type: "STREAMING", url: "https://www.youtube.com/watch?v=sHwvUFjaNdU"});
|
||||||
|
|
||||||
// Start the karma and vibe chat thingy
|
// Start the module thingys
|
||||||
require('./karma');
|
require('./karma');
|
||||||
require('./vibechat');
|
require('./vibechat');
|
||||||
|
require('./shitposts');
|
||||||
});
|
});
|
||||||
|
|
||||||
client.on('guildCreate', g => {
|
client.on('guildCreate', g => {
|
||||||
|
|
8
karma.js
8
karma.js
|
@ -34,6 +34,12 @@ const awards = {
|
||||||
cost: 20000,
|
cost: 20000,
|
||||||
give: 2500,
|
give: 2500,
|
||||||
role: "733407211178557583"
|
role: "733407211178557583"
|
||||||
|
},
|
||||||
|
"739266335128944683": {
|
||||||
|
name: "Argentobamium",
|
||||||
|
cost: 100000,
|
||||||
|
give: 69420,
|
||||||
|
role: "739266563038904421"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +80,7 @@ client.on('messageReactionAdd', async function(reaction, user) {
|
||||||
}
|
}
|
||||||
coins.set(user.id, (coins.get(user.id) - award.cost));
|
coins.set(user.id, (coins.get(user.id) - award.cost));
|
||||||
coins.set(message.author.id, (coins.get(message.author.id) + award.give));
|
coins.set(message.author.id, (coins.get(message.author.id) + award.give));
|
||||||
message.channel.send(`${message.author} has received the ${award.name} award${award.give > 0 ? ` and ${award.give} coins` : ''} by ${user}!`);
|
message.channel.send(`${user} just gave the ${client.emojis.cache.get(reaction.emoji.id).toString()} ${award.name} award (Price: ${award.cost} coins) to ${message.author}${award.give > 0 ? `. ${message.author.username} has received ${award.give} coins` : ''}!`);
|
||||||
require('./karma').updateRoles(user.id);
|
require('./karma').updateRoles(user.id);
|
||||||
require('./karma').updateRoles(message.author.id);
|
require('./karma').updateRoles(message.author.id);
|
||||||
}
|
}
|
||||||
|
|
34
shitposts.js
Normal file
34
shitposts.js
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
const Discord = require('discord.js');
|
||||||
|
const client = require('./index').client;
|
||||||
|
|
||||||
|
const tChannelID = '740207856288268289';
|
||||||
|
const emoji = '719181283393142786';
|
||||||
|
|
||||||
|
client.on('messageReactionAdd', async function(reaction, user) {
|
||||||
|
|
||||||
|
let publish = false;
|
||||||
|
|
||||||
|
// Fetch partials
|
||||||
|
if (reaction.partial) reaction = await reaction.fetch();
|
||||||
|
if (user.partial) user = await user.fetch();
|
||||||
|
|
||||||
|
if (user.bot && user.id != client.user.id) return;
|
||||||
|
if (reaction.message.channel.id != tChannelID) return;
|
||||||
|
if (reaction.message.channel.type != 'news') return;
|
||||||
|
|
||||||
|
if (reaction.emoji.id != emoji) return;
|
||||||
|
|
||||||
|
const count = reaction.message.reactions.cache.filter(e => e.emoji.id == emoji).array()[0].count;
|
||||||
|
|
||||||
|
if (count == reaction.message.attachments.array().length > 0 ? 3 : 5) publish = true; // When the message has an attachment, publish it at 3 upvotes, else at 5
|
||||||
|
|
||||||
|
// This publishes the message using a direct API call. (Copied from https://github.com/Forcellrus/Discord-Auto-Publisher/blob/master/bot.js)
|
||||||
|
if (!publish) return;
|
||||||
|
reaction.message.react(client.emojis.cache.get('730053273561727063')).catch();
|
||||||
|
await fetch(`https://discord.com/api/v6/channels/${reaction.message.channel.id}/messages/${reaction.message.id}/crosspost`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bot ${require('./config.json').token}`,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in a new issue