Compare commits
2 commits
d93d42a131
...
823c1d4de8
Author | SHA1 | Date | |
---|---|---|---|
823c1d4de8 | |||
bd38870c44 |
11 changed files with 108 additions and 112 deletions
|
@ -2,19 +2,19 @@ module.exports = class Command {
|
||||||
constructor (name, category) {
|
constructor (name, category) {
|
||||||
// Gateway stuff
|
// Gateway stuff
|
||||||
this.name = name,
|
this.name = name,
|
||||||
this.description = "No description provided.",
|
this.description = 'No description provided.',
|
||||||
this.options = [],
|
this.options = [],
|
||||||
this.permissions = {
|
this.permissions = {
|
||||||
DEFAULT_MEMBER_PERMISSIONS: "SendMessages"
|
DEFAULT_MEMBER_PERMISSIONS: 'SendMessages'
|
||||||
}
|
};
|
||||||
this.dm_permission = false,
|
this.dm_permission = false,
|
||||||
// Extra stuff Woomy uses internally
|
// Extra stuff Woomy uses internally
|
||||||
this.category = category,
|
this.category = category,
|
||||||
this.usage = "No usage information provided.",
|
this.usage = 'No usage information provided.',
|
||||||
this.friendlyOptions = "No options provided."
|
this.friendlyOptions = 'No options provided.',
|
||||||
this.enabled = true,
|
this.enabled = true,
|
||||||
this.devOnly = false,
|
this.devOnly = false,
|
||||||
this.cooldown = 2000
|
this.cooldown = 2000;
|
||||||
}
|
}
|
||||||
|
|
||||||
run (client, interaction, data) { //eslint-disable-line no-unused-vars
|
run (client, interaction, data) { //eslint-disable-line no-unused-vars
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
const Command = require("../../base/Command.js");
|
const Command = require('../../base/Command.js');
|
||||||
const replies = require('../../assets/replies.json');
|
const replies = require('../../assets/replies.json');
|
||||||
|
|
||||||
module.exports = class Ping extends Command {
|
module.exports = class Ping extends Command {
|
||||||
constructor (name, category) {
|
constructor (name, category) {
|
||||||
super (name, category)
|
super (name, category);
|
||||||
this.name = name,
|
this.name = name,
|
||||||
this.description = 'Check response time between Woomy and Discord',
|
this.description = 'Check response time between Woomy and Discord',
|
||||||
this.category = category
|
this.category = category;
|
||||||
}
|
}
|
||||||
|
|
||||||
async run (client, interaction, data) { //eslint-disable-line no-unused-vars
|
async run (client, interaction, data) { //eslint-disable-line no-unused-vars
|
||||||
|
|
|
@ -1,32 +1,32 @@
|
||||||
const Command = require("../../base/Command.js");
|
const Command = require('../../base/Command.js');
|
||||||
|
|
||||||
module.exports = class Avatar extends Command {
|
module.exports = class Avatar extends Command {
|
||||||
constructor (name, category) {
|
constructor (name, category) {
|
||||||
super (name, category)
|
super (name, category);
|
||||||
this.name = name,
|
this.name = name,
|
||||||
this.description = 'View a full-sized version of someone\'s avatar.',
|
this.description = 'View a full-sized version of someone\'s avatar.',
|
||||||
this.options = [
|
this.options = [
|
||||||
{
|
{
|
||||||
type: 6,
|
type: 6,
|
||||||
name: "user",
|
name: 'user',
|
||||||
description: "The user to get the avatar of."
|
description: 'The user to get the avatar of.'
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
this.usage = "/avatar [user]"
|
this.usage = '/avatar [user]',
|
||||||
this.friendlyOptions = "`user` - The user to get the avatar of (optional)",
|
this.friendlyOptions = '`user` - The user to get the avatar of (optional)',
|
||||||
this.category = category
|
this.category = category;
|
||||||
}
|
}
|
||||||
|
|
||||||
async run (client, interaction, data) { //eslint-disable-line no-unused-vars
|
async run (client, interaction, data) { //eslint-disable-line no-unused-vars
|
||||||
const target = await interaction.options.getUser('user') ?? interaction.user;
|
const target = await interaction.options.getUser('user') ?? interaction.user;
|
||||||
const user = await client.users.fetch(target.id, {force: true})
|
const user = await client.users.fetch(target.id, {force: true});
|
||||||
const member = await interaction.guild.members.fetch(target.id, {force: true})
|
const member = await interaction.guild.members.fetch(target.id, {force: true});
|
||||||
|
|
||||||
const embed = new client.EmbedBuilder()
|
const embed = new client.EmbedBuilder()
|
||||||
.setTitle(user.username + '#' + user.discriminator + "'s avatar")
|
.setTitle(user.username + '#' + user.discriminator + '\'s avatar')
|
||||||
.setColor(user.hexAccentColor ?? member.displayHexColor)
|
.setColor(user.hexAccentColor ?? member.displayHexColor)
|
||||||
.setDescription(`[Global avatar](${user.avatarURL({extension: "png", "size": 4096})})`)
|
.setDescription(`[Global avatar](${user.avatarURL({extension: 'png', 'size': 4096})})`)
|
||||||
.setImage(member.displayAvatarURL({extension: "png", "size": 4096}));
|
.setImage(member.displayAvatarURL({extension: 'png', 'size': 4096}));
|
||||||
|
|
||||||
await interaction.reply({embeds: [embed]});
|
await interaction.reply({embeds: [embed]});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const Command = require("../../base/Command.js");
|
const Command = require('../../base/Command.js');
|
||||||
const fetch = require('node-fetch');
|
const fetch = require('node-fetch');
|
||||||
const windrose = require('windrose');
|
const windrose = require('windrose');
|
||||||
const ISO2 = require('../../assets/ISO2.json');
|
const ISO2 = require('../../assets/ISO2.json');
|
||||||
|
@ -6,41 +6,41 @@ const ISO2 = require('../../assets/ISO2.json');
|
||||||
|
|
||||||
module.exports = class Weather extends Command {
|
module.exports = class Weather extends Command {
|
||||||
constructor (name, category) {
|
constructor (name, category) {
|
||||||
super (name, category)
|
super (name, category);
|
||||||
this.name = name,
|
this.name = name,
|
||||||
this.description = 'View the weather in a place ',
|
this.description = 'View the weather in a place ',
|
||||||
this.options = [
|
this.options = [
|
||||||
{
|
{
|
||||||
type: 3,
|
type: 3,
|
||||||
name: "city",
|
name: 'city',
|
||||||
description: "The city to check the weather at",
|
description: 'The city to check the weather at',
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 3,
|
type: 3,
|
||||||
name: "country",
|
name: 'country',
|
||||||
description: "The country the city is in",
|
description: 'The country the city is in',
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
this.category = category,
|
this.category = category,
|
||||||
this.cooldown = 10000
|
this.cooldown = 10000;
|
||||||
};
|
}
|
||||||
|
|
||||||
async run (client, interaction, data) { //eslint-disable-line no-unused-vars
|
async run (client, interaction, data) { //eslint-disable-line no-unused-vars
|
||||||
|
|
||||||
const city = await interaction.options.get('city').value;
|
const city = await interaction.options.get('city').value;
|
||||||
let country = await interaction.options.get('country');
|
let country = await interaction.options.get('country');
|
||||||
let countryCode = "";
|
let countryCode = '';
|
||||||
|
|
||||||
if (country) {
|
if (country) {
|
||||||
country = country.value;
|
country = country.value;
|
||||||
countryCode += ","
|
countryCode += ',';
|
||||||
if (ISO2.country[country.toProperCase().trim()]) {
|
if (ISO2.country[country.toProperCase().trim()]) {
|
||||||
countryCode += ISO2.country[country.toProperCase().trim()];
|
countryCode += ISO2.country[country.toProperCase().trim()];
|
||||||
} else {
|
} else {
|
||||||
countryCode += country.trim();
|
countryCode += country.trim();
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
fetch(`https://api.openweathermap.org/data/2.5/weather?q=${city + countryCode}&appid=${client.config.keys.weather}`, { headers: { 'User-Agent': client.config.userAgent }})
|
fetch(`https://api.openweathermap.org/data/2.5/weather?q=${city + countryCode}&appid=${client.config.keys.weather}`, { headers: { 'User-Agent': client.config.userAgent }})
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
|
@ -84,14 +84,14 @@ module.exports = class Weather extends Command {
|
||||||
content: `${client.config.emojis.userError} ${city.toProperCase()} is not listed in my sources.`,
|
content: `${client.config.emojis.userError} ${city.toProperCase()} is not listed in my sources.`,
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
client.logger.error('WEATHER_COMMAND_ERROR', `API Error: ${json}`)
|
client.logger.error('WEATHER_COMMAND_ERROR', `API Error: ${json}`);
|
||||||
return interaction.reply({
|
return interaction.reply({
|
||||||
content: `${client.config.emojis.botError} API error occurred: \`code ${json.cod}\``,
|
content: `${client.config.emojis.botError} API error occurred: \`code ${json.cod}\``,
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
}
|
||||||
};
|
};
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
const { REST, Routes } = require('discord.js');
|
const { REST, Routes } = require('discord.js');
|
||||||
const { clientId, token } = require('../botconfig.json');
|
const { clientId, token } = require('../botconfig.json');
|
||||||
const guildId = "413591792185769984";
|
const guildId = '413591792185769984';
|
||||||
const read = require('fs-readdir-recursive');
|
const read = require('fs-readdir-recursive');
|
||||||
const commands = [];
|
const commands = [];
|
||||||
const commandFiles = read('./commands').filter(file => file.endsWith('.js'));
|
const commandFiles = read('./commands').filter(file => file.endsWith('.js'));
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
|
|
||||||
class EventHandler {
|
class EventHandler {
|
||||||
|
|
||||||
constructor (client) {
|
constructor (client) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const Event = require("../../base/Event.js");
|
const Event = require('../../base/Event.js');
|
||||||
module.exports = class InteractionHandler extends Event {
|
module.exports = class InteractionHandler extends Event {
|
||||||
constructor (wsEvent) {
|
constructor (wsEvent) {
|
||||||
super (wsEvent);
|
super (wsEvent);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const Event = require("../../base/Event.js");
|
const Event = require('../../base/Event.js');
|
||||||
const activities = require('../../assets/activities.json');
|
const activities = require('../../assets/activities.json');
|
||||||
module.exports = class Activity extends Event {
|
module.exports = class Activity extends Event {
|
||||||
constructor (wsEvent) {
|
constructor (wsEvent) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const Event = require("../../base/Event.js");
|
const Event = require('../../base/Event.js');
|
||||||
module.exports = class Ready extends Event {
|
module.exports = class Ready extends Event {
|
||||||
constructor (wsEvent) {
|
constructor (wsEvent) {
|
||||||
super (wsEvent);
|
super (wsEvent);
|
||||||
|
|
|
@ -32,7 +32,7 @@ class Functions {
|
||||||
return Math.round((Math.random() * (max - min) + min));
|
return Math.round((Math.random() * (max - min) + min));
|
||||||
}
|
}
|
||||||
|
|
||||||
randomColour () {
|
randomColor () {
|
||||||
const n = (Math.random() * 0xfffff * 1000000).toString(16);
|
const n = (Math.random() * 0xfffff * 1000000).toString(16);
|
||||||
return '#' + n.slice(0, 6);
|
return '#' + n.slice(0, 6);
|
||||||
}
|
}
|
||||||
|
@ -51,10 +51,6 @@ class Functions {
|
||||||
return role;
|
return role;
|
||||||
}
|
}
|
||||||
|
|
||||||
searchMembers (guild, input) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
embedColor (guild, member) {
|
embedColor (guild, member) {
|
||||||
if (!member) {
|
if (!member) {
|
||||||
return guild.members.cache.get(this.client.user.id).displayHexColor;
|
return guild.members.cache.get(this.client.user.id).displayHexColor;
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Logger {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log something related to being successful
|
* Log something related to being successful
|
||||||
* @param {string} title The title of the log enty
|
* @param {string} title The title of the log entry
|
||||||
* @param {string} body The body of the log entry
|
* @param {string} body The body of the log entry
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
|
@ -44,7 +44,7 @@ class Logger {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log something related to a warning
|
* Log something related to a warning
|
||||||
* @param {string} title The title of the log enty
|
* @param {string} title The title of the log entry
|
||||||
* @param {string} body The body of the log entry
|
* @param {string} body The body of the log entry
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
|
@ -54,7 +54,7 @@ class Logger {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log something related to an error
|
* Log something related to an error
|
||||||
* @param {string} title The title of the log enty
|
* @param {string} title The title of the log entry
|
||||||
* @param {string} body The body of the log entry
|
* @param {string} body The body of the log entry
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
|
@ -64,7 +64,7 @@ class Logger {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log something related to debugging
|
* Log something related to debugging
|
||||||
* @param {string} title The title of the log enty
|
* @param {string} title The title of the log entry
|
||||||
* @param {string} body The body of the log entry
|
* @param {string} body The body of the log entry
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue