Skip to content

Commit

Permalink
Merge pull request #22 from akash5100/minorBugs
Browse files Browse the repository at this point in the history
fixed few hardcoded tags
  • Loading branch information
ozer550 authored Apr 8, 2022
2 parents c3ca3ca + 11d0f18 commit 53cdef9
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 51 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
DISCORD_GUILD_ID=<Your server id>
DISCORD_TOKEN=<Your Discord bot token(Client secret)>
DISCORD_CLIENT_ID=<Discord bot Client id>
DISCORD_CLIENT_ID=<Discord bot Client id>
INVITE_LINK= < invitation link to a voice channel set it to No expire + no limit >
56 changes: 30 additions & 26 deletions command-builder.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
const { SlashCommandBuilder } = require('@discordjs/builders');

const commands = [
new SlashCommandBuilder()
.setName('ping')
.setDescription('Replies with pong!'),
new SlashCommandBuilder()
.setName('server')
.setDescription('Replies with server info!'),
new SlashCommandBuilder()
.setName('user')
.setDescription('Replies with user info!'),
new SlashCommandBuilder()
.setName('m')
.setDescription('Is there someone available who can help me')
.addNumberOption((option) =>
option.setName('minutes').setDescription('Amount of time we need.')
),
new SlashCommandBuilder().setName('l').setDescription('Help others'),
new SlashCommandBuilder().setName('p').setDescription('Priority list'),
new SlashCommandBuilder().setName('r').setDescription('respond to someone'),
new SlashCommandBuilder().setName('mc').setDescription('Critical Priority'),
new SlashCommandBuilder().setName('mh').setDescription('High Priority'),
new SlashCommandBuilder().setName('mm').setDescription('Medium Priority'),
new SlashCommandBuilder().setName('ml').setDescription('Low Priority'),
new SlashCommandBuilder().setName('help').setDescription('List of all the commands'),
new SlashCommandBuilder().setName('h').setDescription('List of all the commands'),
new SlashCommandBuilder()
.setName('ping')
.setDescription('Replies with pong!'),
new SlashCommandBuilder()
.setName('server')
.setDescription('Replies with server info!'),
new SlashCommandBuilder()
.setName('user')
.setDescription('Replies with user info!'),
new SlashCommandBuilder()
.setName('m')
.setDescription('Is there someone available who can help me')
.addNumberOption((option) =>
option.setName('minutes').setDescription('Amount of time we need.')
),
new SlashCommandBuilder().setName('l').setDescription('Help others'),
new SlashCommandBuilder().setName('p').setDescription('Priority list'),
new SlashCommandBuilder().setName('r').setDescription('respond to someone'),
new SlashCommandBuilder().setName('mc').setDescription('Critical Priority'),
new SlashCommandBuilder().setName('mh').setDescription('High Priority'),
new SlashCommandBuilder().setName('mm').setDescription('Medium Priority'),
new SlashCommandBuilder().setName('ml').setDescription('Low Priority'),
new SlashCommandBuilder()
.setName('help')
.setDescription('List of all the commands'),
new SlashCommandBuilder()
.setName('h')
.setDescription('List of all the commands'),
].map((command) => command.toJSON());

module.exports = {
getAllCommands: () => commands
};
getAllCommands: () => commands,
};
52 changes: 28 additions & 24 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const { Client, Intents, MessageEmbed } = require('discord.js');
const CommandsBuilder = require('./command-builder');
require('dotenv').config();

const LINK = process.env.INVITE_LINK;
// Create a new client instance
const client = new Client({
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES],
Expand All @@ -11,8 +12,8 @@ const client = new Client({
// When the client is ready, run this code (only once)
client.once('ready', () => {
console.log('Ready!');
client.user.setActivity("/help", {
type: "LISTENING"
client.user.setActivity('/help', {
type: 'LISTENING',
});
});

Expand Down Expand Up @@ -54,11 +55,12 @@ client.on('interactionCreate', async (interaction) => {
} else if (commandName === 'm') {
const minutes = interaction.options.getNumber('minutes') || 30;
await interaction.reply(
`Hi, is anyone around to help @audreyfeldroy for ${minutes} minutes?` + '@here'
`Hi, is anyone around to help <@${interaction.user.id}> for ${minutes} minutes?` +
'@here'
);
} else if (commandName === 'l') {
await interaction.reply(
'Hey everyone, @audreyfeldroy is available in the General voice channel if anyone needs help. @here'
`Hey everyone, <@${interaction.user.id}> is available at General voice channel. If anyone needs help @here, \nJoin ${LINK}`
);
} else if (commandName === 'p') {
interaction.channel.send(
Expand Down Expand Up @@ -102,36 +104,38 @@ client.on('interactionCreate', async (interaction) => {

// interaction.user.voice.setChannel(process.env.LOUNGE_VC_ID);
} else if (commandName[0] === 'm') {
const newEmbed = new MessageEmbed()
const newEmbed = new MessageEmbed();
switch (commandName[1]) {
case "c":
newEmbed.setColor('#ff3030').setTitle(`Priority is **Critical**`)
break
case "h":
newEmbed.setColor('#ff7b1c').setTitle(`Priority is **High**`)
break
case "m":
newEmbed.setColor('#1c7eff').setTitle(`Priority is **Medium**`)
break
case "l":
newEmbed.setColor('#55c278').setTitle(`Priority is **Low**`)
break
case 'c':
newEmbed.setColor('#ff3030').setTitle(`Priority is **Critical**`);
break;
case 'h':
newEmbed.setColor('#ff7b1c').setTitle(`Priority is **High**`);
break;
case 'm':
newEmbed.setColor('#1c7eff').setTitle(`Priority is **Medium**`);
break;
case 'l':
newEmbed.setColor('#55c278').setTitle(`Priority is **Low**`);
break;
}
await interaction.channel.send(`Hi is anyone around to help me for 30min minutes? @here`)
await interaction.channel.send(
`Hi is anyone around to help me for 30min minutes? @here`
);
await interaction.reply({ embeds: [newEmbed] });
} else if (commandName === 'help' || commandName === 'h') {
const helpEmbed = new MessageEmbed()
.setColor("#3c7168")
.setAuthor("FingerTips Plugins Commands", client.user.displayAvatarURL())
.setColor('#3c7168')
.setAuthor('FingerTips Plugins Commands', client.user.displayAvatarURL())
.addFields(
CommandsBuilder.getAllCommands().map(cmd => {
CommandsBuilder.getAllCommands().map((cmd) => {
return {
name: `\`/${cmd.name}\``,
value: cmd.description,
inline: true
}
inline: true,
};
})
)
);
await interaction.reply({ embeds: [helpEmbed] });
}
});
Expand Down

0 comments on commit 53cdef9

Please sign in to comment.