mirror of
				https://github.com/keanuplayz/TravBot-v3.git
				synced 2024-08-15 02:33:12 +00:00 
			
		
		
		
	Move even more fun commands into interactions api
This commit is contained in:
		
							parent
							
								
									a8cc1b4dad
								
							
						
					
					
						commit
						7482f193e2
					
				
					 4 changed files with 50 additions and 1 deletions
				
			
		|  | @ -1,5 +1,13 @@ | ||||||
|  | import {SlashCommandBuilder} from "@discordjs/builders"; | ||||||
|  | import {CommandInteraction} from "discord.js"; | ||||||
| import {NamedCommand, CHANNEL_TYPE} from "onion-lasers"; | import {NamedCommand, CHANNEL_TYPE} from "onion-lasers"; | ||||||
| 
 | 
 | ||||||
|  | export const header = new SlashCommandBuilder().setDescription("Chooses someone to love."); | ||||||
|  | export async function handler(interaction: CommandInteraction) { | ||||||
|  |     const member = interaction.guild!.members.cache.random(); | ||||||
|  |     if (!member) return interaction.reply("For some reason, an error occurred fetching a member."); | ||||||
|  |     return interaction.reply(`I love ${member.nickname ?? member.user.username}!`); | ||||||
|  | } | ||||||
| export default new NamedCommand({ | export default new NamedCommand({ | ||||||
|     description: "Chooses someone to love.", |     description: "Chooses someone to love.", | ||||||
|     channelType: CHANNEL_TYPE.GUILD, |     channelType: CHANNEL_TYPE.GUILD, | ||||||
|  |  | ||||||
|  | @ -1,3 +1,5 @@ | ||||||
|  | import {SlashCommandBuilder} from "@discordjs/builders"; | ||||||
|  | import {CommandInteraction} from "discord.js"; | ||||||
| import {NamedCommand} from "onion-lasers"; | import {NamedCommand} from "onion-lasers"; | ||||||
| import {random} from "../../lib"; | import {random} from "../../lib"; | ||||||
| 
 | 
 | ||||||
|  | @ -58,7 +60,10 @@ const responses = [ | ||||||
|     "cat", |     "cat", | ||||||
|     "large man" |     "large man" | ||||||
| ]; | ]; | ||||||
| 
 | export const header = new SlashCommandBuilder().setDescription("Sends random ok message."); | ||||||
|  | export async function handler(interaction: CommandInteraction) { | ||||||
|  |     interaction.reply(`ok ${random(responses)}`); | ||||||
|  | } | ||||||
| export default new NamedCommand({ | export default new NamedCommand({ | ||||||
|     description: "Sends random ok message.", |     description: "Sends random ok message.", | ||||||
|     async run({send}) { |     async run({send}) { | ||||||
|  |  | ||||||
|  | @ -1,6 +1,25 @@ | ||||||
| import {NamedCommand, RestCommand} from "onion-lasers"; | import {NamedCommand, RestCommand} from "onion-lasers"; | ||||||
| import {random} from "../../lib"; | import {random} from "../../lib"; | ||||||
|  | import {SlashCommandBuilder} from "@discordjs/builders"; | ||||||
|  | import {CommandInteraction} from "discord.js"; | ||||||
| 
 | 
 | ||||||
|  | export const header = new SlashCommandBuilder() | ||||||
|  |     .setDescription("OwO-ifies the input.") | ||||||
|  |     .addStringOption((option) => option.setName("text").setDescription("Text to owoify").setRequired(true)); | ||||||
|  | 
 | ||||||
|  | export async function handler(interaction: CommandInteraction) { | ||||||
|  |     const {options} = interaction; | ||||||
|  |     const faces = ["owo", "UwU", ">w<", "^w^"]; | ||||||
|  |     const owoified = options | ||||||
|  |         .getString("text", true) | ||||||
|  |         .replace(/[rl]/g, "w") | ||||||
|  |         .replace(/[RL]/g, "W") | ||||||
|  |         .replace(/ove/g, "uv") | ||||||
|  |         .replace(/n/g, "ny") | ||||||
|  |         .replace(/N/g, "NY") | ||||||
|  |         .replace(/\!/g, ` ${random(faces)} `); | ||||||
|  |     interaction.reply(owoified); | ||||||
|  | } | ||||||
| export default new NamedCommand({ | export default new NamedCommand({ | ||||||
|     description: "OwO-ifies the input.", |     description: "OwO-ifies the input.", | ||||||
|     run: "You need to specify some text to owoify.", |     run: "You need to specify some text to owoify.", | ||||||
|  |  | ||||||
|  | @ -1,6 +1,23 @@ | ||||||
| import {MessageAttachment, User} from "discord.js"; | import {MessageAttachment, User} from "discord.js"; | ||||||
| import {NamedCommand, Command, RestCommand, getUserByNickname} from "onion-lasers"; | import {NamedCommand, Command, RestCommand, getUserByNickname} from "onion-lasers"; | ||||||
| import petPetGif from "pet-pet-gif"; | import petPetGif from "pet-pet-gif"; | ||||||
|  | import {SlashCommandBuilder} from "@discordjs/builders"; | ||||||
|  | import {CommandInteraction} from "discord.js"; | ||||||
|  | 
 | ||||||
|  | //Ravioli ravioli...
 | ||||||
|  | //number from 1 to 9
 | ||||||
|  | export const header = new SlashCommandBuilder() | ||||||
|  |     .setDescription("Generates a pat GIF of the avatar of the mentioned user.") | ||||||
|  |     .addUserOption((option) => option.setName("user").setDescription("User you want a pat gif of.").setRequired(true)); | ||||||
|  | 
 | ||||||
|  | export async function handler(interaction: CommandInteraction) { | ||||||
|  |     await interaction.reply("Generating pat gif..."); | ||||||
|  |     const {options} = interaction; | ||||||
|  |     const pfp = options.getUser("user", true).displayAvatarURL({format: "png"}); | ||||||
|  |     const gif = await petPetGif(pfp); | ||||||
|  |     const file = new MessageAttachment(gif, "pat.gif"); | ||||||
|  |     await interaction.editReply({content: "Here you go!", files: [file]}); | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| export default new NamedCommand({ | export default new NamedCommand({ | ||||||
|     description: "Generates a pat GIF of the provided attachment image OR the avatar of the mentioned user.", |     description: "Generates a pat GIF of the provided attachment image OR the avatar of the mentioned user.", | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue