Skip to content

Commit

Permalink
Experimental Build (v0.1.1-Ealpha) Snapshot 1s2a
Browse files Browse the repository at this point in the history
Reaction roles are in progress of being made.

Added command to assign emojis, added commnand to assign reactions and to send the reaction role message. For some reason the process of giving out roles is a bit bugged and it works on some servers and on some doesn't.

Bug removal process in progress. Development also in progress.
  • Loading branch information
MISTCLICK authored Aug 31, 2020
1 parent 2337755 commit 6351f3c
Show file tree
Hide file tree
Showing 11 changed files with 831 additions and 64 deletions.
12 changes: 12 additions & 0 deletions ReactRoles.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"R1": "",
"R2": "",
"R3": "",
"R4": "",
"R5": "",
"R6": "",
"R7": "",
"R8": "",
"R9": "",
"R10": ""
}
12 changes: 12 additions & 0 deletions ReactRolesR.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"RR1": "",
"RR2": "",
"RR3": "",
"RR4": "",
"RR5": "",
"RR6": "",
"RR7": "",
"RR8": "",
"RR9": "",
"RR10": ""
}
1 change: 1 addition & 0 deletions commands/ReactRoles.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions commands/ReactRolesR.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
2 changes: 1 addition & 1 deletion commands/announce.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ module.exports = {
.setImage(ImageURL)
.setFooter(Footer)

message.channel.send(NewAnnouncementEmbed).catch(console.log.errors).then(() => {
message.channel.send('Notifying @ everyone', NewAnnouncementEmbed).catch(console.log.errors).then(() => {
message.channel.send('This was the preview of your announcement. To publish it type "!confirm", to cancel type "!cancel", to start over type "!announce".').then(() => {
client.AnnouncementEmbedInfo = {
"title": title,
Expand Down
2 changes: 1 addition & 1 deletion commands/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
if (!args.length) {
return message.channel.send('No arguments provided!');
} else if(args[0] === 'scared') {
return message.react('748614633396502569');
return message.react(':penelopeAH:748614633396502569');
} else if(args[0] === 'stalin') {
return message.react('748840646646824970');
}
Expand Down
346 changes: 346 additions & 0 deletions commands/rrea.js

Large diffs are not rendered by default.

363 changes: 327 additions & 36 deletions commands/rrmsgc.js

Large diffs are not rendered by default.

140 changes: 115 additions & 25 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ client.AnnouncementEmbedInfo = require('./AnnouncementEmbedInfo.json');
client.commands = new Discord.Collection();

const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
for(const file of commandFiles){
for (const file of commandFiles) {
const command = require(`./commands/${file}`);

client.commands.set(command.name, command);
Expand All @@ -22,55 +22,55 @@ client.once('ready', () => {
client.user.setActivity('Alpha 0.1.0 | !help', { type: 'PLAYING' });
});

client.on('message', message => {
if(!message.content.startsWith(prefix) || message.author.bot) return;
client.on('message', async message => {
if (!message.content.startsWith(prefix) || message.author.bot) return;

const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();

if(command === 'ping'){
if (command === 'ping') {
client.commands.get('ping').execute(message, args);
} else if(command === 'help'){
} else if (command === 'help') {
client.commands.get('help').execute(message, args);
} else if(command === 'faq'){
} else if (command === 'faq') {
if (!args.length) {
return client.commands.get('faq').execute(message, args);
} else if(args[0] === '1') {
} else if (args[0] === '1') {
return client.commands.get('faq1').execute(message, args);
}
} else if(command === 'react'){
} else if (command === 'react') {
client.commands.get('react').execute(message, args);
} else if(command === 'announce'){
client.commands.get('announce').execute(message, args);
} else if(command === 'confirm'){
} else if (command === 'announce') {
client.commands.get('announce').execute(message, args);
} else if (command === 'confirm') {
const AnnData = fs.readFileSync('./AnnouncementEmbedInfo.json');
const AnnInfo = JSON.parse(AnnData);
const { title } = AnnInfo;
const { titleURL } = AnnInfo;
const { descriptionAnn } = AnnInfo;
const { Footer } = AnnInfo;
const { ImageURL } = AnnInfo;
if(message.member.roles.cache.has('748827786923475034') && title !== null){
if (message.member.roles.cache.has('748827786923475034') && title !== null) {
const channel = client.channels.cache.get('748873531638677564');

const NewAnnouncementEmbed = new Discord.MessageEmbed()
.setColor('#00309d')
.setAuthor(title, 'https://cdn.discordapp.com/attachments/682219767230365742/745291964244688976/ava.png', titleURL)
.setDescription(descriptionAnn)
.setImage(ImageURL)
.setFooter(Footer)
.setColor('#00309d')
.setAuthor(title, 'https://cdn.discordapp.com/attachments/682219767230365742/745291964244688976/ava.png', titleURL)
.setDescription(descriptionAnn)
.setImage(ImageURL)
.setFooter(Footer)

channel.send(NewAnnouncementEmbed).catch(console.log.errors);
channel.send('Notifying @everyone', NewAnnouncementEmbed).catch(console.log.errors);

client.AnnouncementEmbedInfo = {
"title": null,
"titleURL": null,
"descriptionAnn": null,
"Footer": null,
"ImageURL": null
}
fs.writeFile('./AnnouncementEmbedInfo.json', JSON.stringify (client.AnnouncementEmbedInfo, null, 4), err => {
if(err){
}
fs.writeFile('./AnnouncementEmbedInfo.json', JSON.stringify(client.AnnouncementEmbedInfo, null, 4), err => {
if (err) {
throw err;
} else {
console.log(`${message.author.username} has published the announcement. JSON successfully cleared!`);
Expand All @@ -79,11 +79,101 @@ client.on('message', message => {
} else {
return console.log('Error in publishing the announcement, insufficient premissions or annnouncement not set up correctly!');
}
} else if(command === 'cancel'){
} else if (command === 'cancel') {
client.commands.get('cancel').execute(message, args);
} else if(command === 'reaction-role-msg-create'){
client.commands.get('rrmsgc').execute(message, args);
} else if (command === 'reaction-role-msg-create') {
if (!args.length) {
const ReactRoleData = fs.readFileSync('./ReactRoles.json');
const ReactRoles = JSON.parse(ReactRoleData);
const { R1 } = ReactRoles;
if (R1 != null) {
const ReactRoleData = fs.readFileSync('./ReactRoles.json');
const ReactRoles = JSON.parse(ReactRoleData);
const { R1 } = ReactRoles;
const { R2 } = ReactRoles;
const { R3 } = ReactRoles;
const { R4 } = ReactRoles;
const { R5 } = ReactRoles;
const { R6 } = ReactRoles;
const { R7 } = ReactRoles;
const { R8 } = ReactRoles;
const { R9 } = ReactRoles;
const { R10 } = ReactRoles;

if (message.member.roles.cache.some(role => role.name === 'Mod')) {
const ReactionRoleEmbed = new Discord.MessageEmbed()
.setColor('#00309d')
.setAuthor('vEuroExpress Reaction Roles', 'https://cdn.discordapp.com/attachments/682219767230365742/745291964244688976/ava.png', 'http://veuroexpress.org/')
.setDescription('```Click on the reactions below to get correspondant roles!```')
.setFooter('Found a but? Report it in #support!')
let RREmbed = await message.channel.send(ReactionRoleEmbed);
RREmbed.react(R1);
RREmbed.react(R2);
RREmbed.react(R3);
RREmbed.react(R4);
RREmbed.react(R5);
RREmbed.react(R6);
RREmbed.react(R7);
RREmbed.react(R8);
RREmbed.react(R9);
RREmbed.react(R10)
}
} else {
return console.log('No reactions were found!')
}
} else if (args[0] === 'assign-roles') {
return client.commands.get('rrmsgc').execute(message, args);
} else if (args[0] === 'assign') {
return client.commands.get('rrea').execute(message, args);
}

}
});

client.on('MessageReactionAdd', async (reaction, user) => {
const ReactRoleRData = fs.readFileSync('./ReactRolesR.json');
const ReactRolesR = JSON.parse(ReactRoleRData);
const { RR1 } = ReactRolesR;
const { RR2 } = ReactRolesR;
const { RR3 } = ReactRolesR;
const { RR4 } = ReactRolesR;
const { RR5 } = ReactRolesR;
const { RR6 } = ReactRolesR;
const { RR7 } = ReactRolesR;
const { RR8 } = ReactRolesR;
const { RR9 } = ReactRolesR;
const { RR10 } = ReactRolesR;

if (reaction.message.partial) await reaction.message.fetch();
if (reaction.partial) await reaction.fetch();

if (user.client) return;
if (!reaction.message.guild) return;

if(reaction.message.channel.id === '749562537724608543'){
if (reaction.emoji.name === R1){
await reaction.message.guild.members.cache.get(user.id).roles.add(RR1);
} else if (reaction.emoji.name === R2){
await reaction.message.guild.members.cache.get(user.id).roles.add(RR2);
} else if (reaction.emoji.name === R3){
await reaction.message.guild.members.cache.get(user.id).roles.add(RR3);
} else if (reaction.emoji.name === R4){
await reaction.message.guild.members.cache.get(user.id).roles.add(RR4);
} else if (reaction.emoji.name === R5){
await reaction.message.guild.members.cache.get(user.id).roles.add(RR5);
} else if (reaction.emoji.name === R6){
await reaction.message.guild.members.cache.get(user.id).roles.add(RR6);
} else if (reaction.emoji.name === R7){
await reaction.message.guild.members.cache.get(user.id).roles.add(RR7);
} else if (reaction.emoji.name === R8){
await reaction.message.guild.members.cache.get(user.id).roles.add(RR8);
} else if (reaction.emoji.name === R9){
await reaction.message.guild.members.cache.get(user.id).roles.add(RR9);
} else if (reaction.emoji.name === R10){
await reaction.message.guild.members.cache.get(user.id).roles.add(RR10);
}
}
});
})


client.login(token);
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"license": "MIT",
"dependencies": {
"babel": "^6.23.0",
"discord.js": "^12.3.1"
"discord.js": "^12.3.1",
"git": "^0.1.5"
}
}

0 comments on commit 6351f3c

Please sign in to comment.