Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed few hardcoded tags #22

Merged
merged 1 commit into from
Apr 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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