first commit
This commit is contained in:
41
slash/create_task.js
Normal file
41
slash/create_task.js
Normal file
@ -0,0 +1,41 @@
|
||||
// For HTTP Requests
|
||||
var http = require('unirest');
|
||||
let boardList=[]
|
||||
let embed = []
|
||||
let pages =[]
|
||||
|
||||
|
||||
require("dotenv").config();
|
||||
|
||||
exports.run = async (client, interaction) => {
|
||||
|
||||
// eslint-disable-line no-unused-vars
|
||||
await interaction.deferReply();
|
||||
// const reply = await interaction.editReply("Ping?");
|
||||
// await interaction.editReply(`Pong! Latency is ${reply.createdTimestamp - interaction.createdTimestamp}ms. API Latency is ${Math.round(client.ws.ping)}ms.`);
|
||||
var Request = http.post('https://board.grwh.work/jsonrpc.php').headers({ Accept: 'application/json', 'Content-Type': 'application/json' }).send({ "jsonrpc": "2.0", "method": "getAllProjects", "id": 0 });
|
||||
|
||||
Request.auth({
|
||||
user: 'jsonrpc',
|
||||
pass: process.env.KANBOARD_API_KEY,
|
||||
sendImmediately: false
|
||||
}).then(function (response) {
|
||||
let data = response.body.result
|
||||
console.log(data)
|
||||
|
||||
})
|
||||
};
|
||||
|
||||
exports.commandData = {
|
||||
name: "test",
|
||||
description: "create a task",
|
||||
options: [],
|
||||
defaultPermission: true,
|
||||
};
|
||||
|
||||
// Set guildOnly to true if you want it to be available on guilds only.
|
||||
// Otherwise false is global.
|
||||
exports.conf = {
|
||||
permLevel: "User",
|
||||
guildOnly: false
|
||||
};
|
24
slash/leave.js
Normal file
24
slash/leave.js
Normal file
@ -0,0 +1,24 @@
|
||||
const { Permissions } = require("discord.js");
|
||||
|
||||
exports.run = async (client, interaction) => { // eslint-disable-line no-unused-vars
|
||||
await interaction.deferReply();
|
||||
if (!interaction.guild.me.permissions.has(Permissions.FLAGS.KICK_MEMBERS))
|
||||
return await interaction.editReply("I do not have permission to kick members in this server.");
|
||||
await interaction.member.send("You requested to leave the server, if you change your mind you can rejoin at a later date.");
|
||||
await interaction.member.kick(`${interaction.member.displayName} wanted to leave.`);
|
||||
await interaction.editReply(`${interaction.member.displayName} left in a hurry!`);
|
||||
};
|
||||
|
||||
exports.commandData = {
|
||||
name: "leave",
|
||||
description: "Make's the user leave the guild.",
|
||||
options: [],
|
||||
defaultPermission: true,
|
||||
};
|
||||
|
||||
// Set guildOnly to true if you want it to be available on guilds only.
|
||||
// Otherwise false is global.
|
||||
exports.conf = {
|
||||
permLevel: "User",
|
||||
guildOnly: true
|
||||
};
|
70
slash/list_projects.js
Normal file
70
slash/list_projects.js
Normal file
@ -0,0 +1,70 @@
|
||||
// For HTTP Requests
|
||||
var http = require('unirest');
|
||||
let boardList=[]
|
||||
let embed = []
|
||||
let pages =[]
|
||||
const { MessageEmbed, MessageButton } = require("discord.js");
|
||||
const { Pagination } = require("pagination.djs");
|
||||
|
||||
require("dotenv").config();
|
||||
|
||||
exports.run = async (client, interaction) => {
|
||||
|
||||
const pagination = new Pagination(interaction, {
|
||||
firstEmoji: "⏮", // First button emoji
|
||||
prevEmoji: "◀️", // Previous button emoji
|
||||
nextEmoji: "▶️", // Next button emoji
|
||||
lastEmoji: "⏭", // Last button emoji
|
||||
limit: 2, // number of entries per page
|
||||
idle: 30000, // idle time in ms before the pagination closes
|
||||
ephemeral: false, // ephemeral reply
|
||||
prevDescription: "",
|
||||
postDescription: "",
|
||||
buttonStyle: "SECONDARY",
|
||||
loop: false, // loop through the pages
|
||||
});
|
||||
|
||||
// eslint-disable-line no-unused-vars
|
||||
await interaction.deferReply();
|
||||
// const reply = await interaction.editReply("Ping?");
|
||||
// await interaction.editReply(`Pong! Latency is ${reply.createdTimestamp - interaction.createdTimestamp}ms. API Latency is ${Math.round(client.ws.ping)}ms.`);
|
||||
var Request = http.get('https://board.grwh.work/jsonrpc.php').headers({ Accept: 'application/json', 'Content-Type': 'application/json' }).send({ "jsonrpc": "2.0", "method": "getAllProjects", "id": 0 });
|
||||
|
||||
Request.auth({
|
||||
user: 'jsonrpc',
|
||||
pass: process.env.KANBOARD_API_KEY,
|
||||
sendImmediately: false
|
||||
}).then(function (response) {
|
||||
let data = response.body.result
|
||||
const pusherFunc = board=>boardList.push({name:"Project Name", value:board.name + "\nID: " + board.id + "\n" + "https://board.grwh.work/board/" + board.id});
|
||||
data.forEach(pusherFunc);
|
||||
|
||||
console.log(boardList)
|
||||
pagination.setTitle("Project List");
|
||||
pagination.setDescription("This is a list of all currently active projects.");
|
||||
|
||||
pagination.setColor("#00ff00");
|
||||
pagination.setFooter("Boards:");
|
||||
pagination.setTimestamp();
|
||||
|
||||
pagination.addFields(boardList);
|
||||
pagination.paginateFields(true);
|
||||
pagination.render();
|
||||
|
||||
|
||||
})
|
||||
};
|
||||
|
||||
exports.commandData = {
|
||||
name: "list",
|
||||
description: "Lists all of the current projects",
|
||||
options: [],
|
||||
defaultPermission: true,
|
||||
};
|
||||
|
||||
// Set guildOnly to true if you want it to be available on guilds only.
|
||||
// Otherwise false is global.
|
||||
exports.conf = {
|
||||
permLevel: "User",
|
||||
guildOnly: false
|
||||
};
|
19
slash/ping.js
Normal file
19
slash/ping.js
Normal file
@ -0,0 +1,19 @@
|
||||
exports.run = async (client, interaction) => { // eslint-disable-line no-unused-vars
|
||||
await interaction.deferReply();
|
||||
const reply = await interaction.editReply("Ping?");
|
||||
await interaction.editReply(`Pong! Latency is ${reply.createdTimestamp - interaction.createdTimestamp}ms. API Latency is ${Math.round(client.ws.ping)}ms.`);
|
||||
};
|
||||
|
||||
exports.commandData = {
|
||||
name: "ping",
|
||||
description: "Pongs when pinged.",
|
||||
options: [],
|
||||
defaultPermission: true,
|
||||
};
|
||||
|
||||
// Set guildOnly to true if you want it to be available on guilds only.
|
||||
// Otherwise false is global.
|
||||
exports.conf = {
|
||||
permLevel: "User",
|
||||
guildOnly: false
|
||||
};
|
31
slash/stats.js
Normal file
31
slash/stats.js
Normal file
@ -0,0 +1,31 @@
|
||||
const { version } = require("discord.js");
|
||||
const { codeBlock } = require("@discordjs/builders");
|
||||
const { DurationFormatter } = require("@sapphire/time-utilities");
|
||||
const durationFormatter = new DurationFormatter();
|
||||
|
||||
exports.run = async (client, interaction) => { // eslint-disable-line no-unused-vars
|
||||
const duration = durationFormatter.format(client.uptime);
|
||||
const stats = codeBlock("asciidoc", `= STATISTICS =
|
||||
• Mem Usage :: ${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} MB
|
||||
• Uptime :: ${duration}
|
||||
• Users :: ${client.guilds.cache.map(g => g.memberCount).reduce((a, b) => a + b).toLocaleString()}
|
||||
• Servers :: ${client.guilds.cache.size.toLocaleString()}
|
||||
• Channels :: ${client.channels.cache.size.toLocaleString()}
|
||||
• Discord.js :: v${version}
|
||||
• Node :: ${process.version}`);
|
||||
await interaction.reply(stats);
|
||||
};
|
||||
|
||||
exports.commandData = {
|
||||
name: "stats",
|
||||
description: "Show's the bots stats.",
|
||||
options: [],
|
||||
defaultPermission: true,
|
||||
};
|
||||
|
||||
// Set guildOnly to true if you want it to be available on guilds only.
|
||||
// Otherwise false is global.
|
||||
exports.conf = {
|
||||
permLevel: "User",
|
||||
guildOnly: false
|
||||
};
|
Reference in New Issue
Block a user