-
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.
Added playlists for play, meme command, help command and status command
- Loading branch information
Showing
18 changed files
with
288 additions
and
101 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 @@ | ||
import { SlashCommandBuilder } from "discord.js"; | ||
import { Command, deploy } from "../lib/command"; | ||
import { Embeds } from "../lib/utils/embeds"; | ||
import { COMMANDS } from "."; | ||
|
||
const MY_SNOWFLAKE = "140520164629151744"; | ||
|
||
export const Deploy: Command = { | ||
data: new SlashCommandBuilder() | ||
.setName('deploy') | ||
.setDescription('Deploys slash commands for the bot.'), | ||
execute: async (client, interaction) => { | ||
if (interaction.user.id === MY_SNOWFLAKE) { | ||
deploy(); | ||
await Embeds.send(interaction, embed => embed | ||
.setTitle("Deployed commands") | ||
.setDescription(`${COMMANDS.length} commands have been deployed.`)); | ||
} else await Embeds.error(interaction, "You do not have permission to execute this command!"); | ||
}, | ||
} |
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,17 @@ | ||
import { SlashCommandBuilder } from "discord.js"; | ||
import { Command } from "../lib/command"; | ||
import { Embeds } from "../lib/utils/embeds"; | ||
import { Time } from "../lib/utils/misc"; | ||
import { COMMANDS } from "."; | ||
|
||
export const Help: Command = { | ||
data: new SlashCommandBuilder() | ||
.setName('help') | ||
.setDescription('Lists all the available commands.'), | ||
execute: async (client, interaction) => { | ||
await Embeds.send(interaction, embed => embed | ||
.setTitle("Help") | ||
.setDescription(`There's a lot I can do for you. Here is a list of the avaliable commands:`) | ||
.addFields(COMMANDS.map(command => ({ name: `/${command.data.name}`, value: command.data.description, inline: true })))); | ||
}, | ||
} |
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 @@ | ||
import { Play } from "../commands/voice/play"; | ||
import { Skip } from "../commands/voice/skip" | ||
import { Queue } from "../commands/voice/queue"; | ||
import { Stop } from "../commands/voice/stop"; | ||
import { Deploy } from "../commands/deploy"; | ||
import { Status } from "../commands/status"; | ||
import { Meme } from "./meme"; | ||
import { Help } from "./help"; | ||
|
||
export const COMMANDS = [ Help, Play, Skip, Queue, Stop, Meme, Status, Deploy ]; |
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,44 @@ | ||
import { AttachmentBuilder, SlashCommandBuilder } from "discord.js"; | ||
import { Command } from "../lib/command"; | ||
import axios from "axios"; | ||
import { Embeds } from "../lib/utils/embeds"; | ||
|
||
export const Meme: Command = { | ||
data: new SlashCommandBuilder() | ||
.setName('meme') | ||
.setDescription('Create a meme with top and bottom text.') | ||
.addStringOption(option => option.setName("top").setRequired(true).setDescription("The text on the top of the meme.")) | ||
.addAttachmentOption(option => option.setName("image").setRequired(true).setDescription("The image to create a meme out of.")) | ||
.addStringOption(option => option.setName("bottom").setRequired(false).setDescription("The text on the bottom of the meme.")), | ||
execute: async (client, interaction) => { | ||
let top = interaction.options.get("top", true); | ||
let bottom = interaction.options.get("bottom", false); | ||
let { attachment } = interaction.options.get("image", true); | ||
|
||
if (!attachment) { | ||
await Embeds.error(interaction, "You must provide an image to generate a meme."); | ||
return; | ||
} | ||
|
||
const res = await axios.post("https://api.memegen.link/images/custom", | ||
{ | ||
"background": attachment.url, | ||
"text": bottom ? [ top.value, bottom.value ] : [ top.value ], | ||
"extension": "png", | ||
"redirect": false | ||
}, | ||
{ | ||
headers: { | ||
"Content-Type": "application/json" | ||
} | ||
} | ||
).catch(_ => null); | ||
|
||
if (!res) { | ||
await Embeds.error(interaction, "Failed to generate meme. (This probably was the APIs fault, not yours.)"); | ||
return; | ||
} | ||
|
||
interaction.editReply({ files: [ new AttachmentBuilder(res.data.url) ] }); | ||
}, | ||
} |
This file was deleted.
Oops, something went wrong.
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,22 @@ | ||
import { SlashCommandBuilder } from "discord.js"; | ||
import { Command } from "../lib/command"; | ||
import { Embeds } from "../lib/utils/embeds"; | ||
import { Time } from "../lib/utils/misc"; | ||
import { Style } from "../lib/utils/style"; | ||
|
||
const TIME_AT_START = Date.now(); | ||
|
||
export const Status: Command = { | ||
data: new SlashCommandBuilder() | ||
.setName('status') | ||
.setDescription('Shows the current status for the bot.'), | ||
execute: async (client, interaction) => { | ||
await Embeds.send(interaction, embed => embed | ||
.setTitle("Status") | ||
.setDescription(` | ||
Use \`/help\` to see all the commands. \n | ||
Currently running version \`${Style.VERSION}\` using \`${Style.ENGINE_VERSION}\`. | ||
${Style.NAME} has been online for \`${Time.latestTime(Date.now() - TIME_AT_START)}\`. | ||
`)); | ||
}, | ||
} |
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
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
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.