-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from CSC510-G35-Fall2022/journalCommand
Journal command
- Loading branch information
Showing
1,979 changed files
with
225,982 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const { SlashCommandBuilder } = require("@discordjs/builders"); | ||
const { EmbedBuilder } = require("discord.js"); | ||
const fs = require("fs"); | ||
const { parse } = require("csv-parse"); | ||
|
||
module.exports = { | ||
data: new SlashCommandBuilder() | ||
.setName("journal") | ||
.setDescription("Replies with pong"), | ||
async execute(interaction, options) { | ||
num = Math.floor(Math.random() * options.length); | ||
|
||
const embed = new EmbedBuilder() | ||
.setColor(0x0099ff) | ||
.setTitle(options[num]) | ||
.setThumbnail("https://cdn-icons-png.flaticon.com/512/3352/3352475.png") | ||
.setDescription("answer this journal prompt"); | ||
|
||
const messageId = interaction.reply({ embeds: [embed] }); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const { SlashCommandBuilder } = require('@discordjs/builders'); | ||
|
||
module.exports = { | ||
data: new SlashCommandBuilder() | ||
.setName('ping') | ||
.setDescription('Replies with pong'), | ||
async execute(interaction) { | ||
interaction.reply({ content: 'Pong' }) | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const { REST, SlashCommandBuilder, Routes } = require('discord.js'); | ||
const { clientId, guildId, token } = require('./config.json'); | ||
|
||
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!'), | ||
] | ||
.map(command => command.toJSON()); | ||
|
||
const rest = new REST({ version: '10' }).setToken(token); | ||
|
||
rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: commands }) | ||
.then((data) => console.log(`Successfully registered ${data.length} application commands.`)) | ||
.catch(console.error); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module.exports = (client, message) => { | ||
// Ignore all bots | ||
if (message.author.bot) return; | ||
|
||
// Ignore messages not starting with the prefix (in config.json) | ||
if (message.content.indexOf(client.config.prefix) !== 0) return; | ||
|
||
// Our standard argument/command name definition. | ||
const args = message.content.slice(client.config.prefix.length).trim().split(/ +/g); | ||
const command = args.shift().toLowerCase(); | ||
|
||
// Grab the command data from the client.commands Enmap | ||
const cmd = client.commands.get(command); | ||
|
||
// If that command doesn't exist, silently exit and do nothing | ||
if (!cmd) return; | ||
|
||
// Run the command | ||
cmd.run(client, message, args); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
How are you doing today? | ||
What are you grateful for? | ||
What is scaring you right now? | ||
List 3 things you are proud of yourself for: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.