Simp-O-Matic

Dumb Discord bot in TS.
git clone git://git.knutsen.co/Simp-O-Matic
Log | Files | Refs | README | LICENSE

commit bc16da704c6bb621fd56656a780c15f0c51ddaab
parent 2453a56ba639118fdf8eeb601d55cf1162e3fb1c
Author: Bruno <b-coimbra@hotmail.com>
Date:   Fri, 15 May 2020 16:39:10 -0300

added actions helper

Diffstat:
Alib/action.ts | 103+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Alib/commands/hug.ts | 13+++++++++++++
Mlib/commands/kiss.ts | 28+++-------------------------
Alib/commands/lick.ts | 13+++++++++++++
Alib/commands/rape.ts | 13+++++++++++++
Alib/commands/slap.ts | 13+++++++++++++
6 files changed, 158 insertions(+), 25 deletions(-)

diff --git a/lib/action.ts b/lib/action.ts @@ -0,0 +1,103 @@ +import { FORMATS } from './extensions'; +import { Message, MessageEmbed } from 'discord.js'; + +type ActionType = 'kiss' | 'rape' | 'slap' | 'hug' | 'lick'; + +interface Actions { + title: string; + message: string, + images: string[] +} + +const ACTIONS: Record<ActionType, Actions> = { + kiss: { + title: "Uh-oh... You're getting a kissu!", + message: "you got a kiss from", + images: [ + "https://i.imgur.com/a5rkTna.gif", + "https://i.imgur.com/AnYC2Xi.gif", + "https://i.imgur.com/9PbQ9Zl.gif", + "https://i.imgur.com/QZhWnaf.gif", + "https://i.imgur.com/1PEBQB6.gif", + "https://i.imgur.com/qW6BWEn.gif", + "https://i.imgur.com/79hpwpn.gif", + "https://i.imgur.com/RpxJYVD.gif", + "https://i.imgur.com/8fcnQFS.gif", + ] + }, + rape: { + title: "Don't struggle :)", + message: "you got raped by", + images: [ + "https://tenor.com/biv7G.gif", + "https://i.imgur.com/rdZHqDX.gif", + "https://i.imgur.com/DdUkVBo.gif", + "https://i.imgur.com/EcBew8x.gif", + "https://i.imgur.com/0iEZleS.gif", + ] + }, + slap: { + title: "Ouchie! You've been slapped!", + message: "you got slapped by", + images: [ + "https://cdn.weeb.sh/images/HkskD56OG.gif", + "https://cdn.weeb.sh/images/BJSpWec1M.gif", + "https://cdn.weeb.sh/images/Hk6JVkFPb.gif", + "https://cdn.weeb.sh/images/By2iXyFw-.gif", + "https://cdn.weeb.sh/images/H1n57yYP-.gif", + "https://cdn.weeb.sh/images/B1oCmkFw-.gif", + "https://cdn.weeb.sh/images/SkKn-xc1f.gif", + "https://cdn.weeb.sh/images/H16aQJFvb.gif", + "https://cdn.weeb.sh/images/HkK2mkYPZ.gif", + "https://cdn.weeb.sh/images/BJ8o71tD-.gif", + ] + }, + hug: { + title: "Uguu~~ You got a warm hug!", + message: "you got a hug from", + images: [ + "https://cdn.weeb.sh/images/rkIK_u7Pb.gif", + "https://cdn.weeb.sh/images/SJByY_QwW.gif", + "https://cdn.weeb.sh/images/rkYetOXwW.gif", + "https://cdn.weeb.sh/images/S1a0DJhqG.gif", + "https://cdn.weeb.sh/images/SJfEks3Rb.gif", + "https://cdn.weeb.sh/images/HyNJIaVCb.gif", + ] + }, + lick: { + title: "You got a wet lick!", + message: "you got licked by", + images: [ + "https://cdn.weeb.sh/images/H1zlgRuvZ.gif", + "https://cdn.weeb.sh/images/Bkagl0uvb.gif", + "https://cdn.weeb.sh/images/Syg8gx0OP-.gif", + "https://cdn.weeb.sh/images/ryGpGsnAZ.gif", + "https://cdn.weeb.sh/images/rykRHmB6W.gif", + "https://cdn.weeb.sh/images/S1Ill0_vW.gif", + "https://cdn.weeb.sh/images/H1EJxR_vZ.gif", + "https://cdn.weeb.sh/images/H1EJxR_vZ.gif", + "https://cdn.weeb.sh/images/HkEqiExdf.gif", + ] + } +}; + +export default class Action { + static get(action: ActionType, message: Message): MessageEmbed { + const { username: author } = message.author; + const { username: to } = message.mentions.users.first(); + + const reaction = ACTIONS[action]; + const images = reaction.images; + const image = images[Math.floor(Math.random() * images.length)]; + + const embed = new MessageEmbed() + .setColor('#ba3d8a') + .setTitle(reaction.title) + .setDescription( + `${to.format(FORMATS.bold)}, ${reaction.message} \ + ${author.format(FORMATS.bold)}!`.squeeze()) + .setImage(image); + + return embed; + } +} diff --git a/lib/commands/hug.ts b/lib/commands/hug.ts @@ -0,0 +1,13 @@ +import { Message } from 'discord.js'; +import Action from '../action'; + +export default (home_scope: HomeScope) => { + const { message, args } + : { message: Message, args: string[] } = home_scope; + + if (args.length === 0 || message.mentions.users.size === 0) + return message.channel.send( + "You can't hug yourself :("); + + message.channel.send(Action.get('hug', message)); +}; diff --git a/lib/commands/kiss.ts b/lib/commands/kiss.ts @@ -1,5 +1,5 @@ -import { FORMATS } from '.././extensions'; -import { MessageEmbed, Message } from 'discord.js'; +import { Message } from 'discord.js'; +import Action from '../action'; export default (home_scope: HomeScope) => { const { message, args } @@ -9,27 +9,5 @@ export default (home_scope: HomeScope) => { return message.channel.send( "You kissed your own hand. :face_with_hand_over_mouth:"); - const author = message.author.username; - const to = message.mentions.users.first().username; - - const images = [ - "https://i.imgur.com/a5rkTna.gif", - "https://i.imgur.com/AnYC2Xi.gif", - "https://i.imgur.com/9PbQ9Zl.gif", - "https://i.imgur.com/QZhWnaf.gif", - "https://i.imgur.com/1PEBQB6.gif", - "https://i.imgur.com/qW6BWEn.gif", - "https://i.imgur.com/79hpwpn.gif", - "https://i.imgur.com/RpxJYVD.gif", - "https://i.imgur.com/8fcnQFS.gif", - ]; - - const embed = new MessageEmbed() - .setColor('#ba3d8a') - .setTitle("Uh-oh... You're getting a kiss!") - .setDescription(`${to.format(FORMATS.bold)}, you got a kissu from \ - ${author.format(FORMATS.bold)}! :flushed:`.squeeze()) - .setImage(images[Math.floor(Math.random() * images.length)]); - - message.channel.send(embed); + message.channel.send(Action.get('kiss', message)); }; diff --git a/lib/commands/lick.ts b/lib/commands/lick.ts @@ -0,0 +1,13 @@ +import { Message } from 'discord.js'; +import Action from '../action'; + +export default (home_scope: HomeScope) => { + const { message, args } + : { message: Message, args: string[] } = home_scope; + + if (args.length === 0 || message.mentions.users.size === 0) + return message.channel.send( + "You licked your own hand... Tastes salty :yum:"); + + message.channel.send(Action.get('lick', message)); +}; diff --git a/lib/commands/rape.ts b/lib/commands/rape.ts @@ -0,0 +1,13 @@ +import { Message } from 'discord.js'; +import Action from '../action'; + +export default (home_scope: HomeScope) => { + const { message, args } + : { message: Message, args: string[] } = home_scope; + + if (args.length === 0 || message.mentions.users.size === 0) + return message.channel.send( + "You fisted yourself. :point_right: :ok_hand:"); + + message.channel.send(Action.get('rape', message)); +}; diff --git a/lib/commands/slap.ts b/lib/commands/slap.ts @@ -0,0 +1,13 @@ +import { Message } from 'discord.js'; +import Action from '../action'; + +export default (home_scope: HomeScope) => { + const { message, args } + : { message: Message, args: string[] } = home_scope; + + if (args.length === 0 || message.mentions.users.size === 0) + return message.channel.send( + "You slapped yourself in the face. :hand_splayed:"); + + message.channel.send(Action.get('slap', message)); +};