2023-02-22 17:41:33 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import discord
|
|
|
|
import json
|
|
|
|
import random
|
|
|
|
|
|
|
|
intents = discord.Intents.default()
|
|
|
|
intents.message_content = True
|
|
|
|
|
2023-02-24 19:31:53 +00:00
|
|
|
bot = discord.Bot(intents=intents)
|
2023-02-22 17:41:33 +00:00
|
|
|
|
|
|
|
gifs = {}
|
|
|
|
with open("gifs.json") as file:
|
|
|
|
gifs = json.load(file)
|
|
|
|
|
2023-02-24 18:56:51 +00:00
|
|
|
lines = {}
|
|
|
|
with open("lines.json") as file:
|
|
|
|
lines = json.load(file)
|
|
|
|
|
|
|
|
HELP_MESSAGE = """
|
2023-02-25 22:21:06 +00:00
|
|
|
Gif commands:
|
|
|
|
```
|
|
|
|
hug - Hugs target user
|
2023-02-23 18:24:42 +00:00
|
|
|
kiss - Kisses target user
|
|
|
|
cuddle - Cuddles with target user
|
|
|
|
hold - Hold target user's hand
|
|
|
|
pat - Gives the targeted user headpats
|
|
|
|
wag - Makes the target user's tail wag
|
|
|
|
fuck - Does some "stuff" to the target user 😳
|
|
|
|
flush - Makes the target user blush
|
|
|
|
lewd - Makes you say that it's too lewd
|
|
|
|
boop - Boops target user
|
2023-02-25 22:21:06 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
Slash commands:
|
|
|
|
```
|
|
|
|
/help - Shows this message
|
|
|
|
```
|
2023-02-23 18:24:42 +00:00
|
|
|
"""
|
|
|
|
|
2023-02-25 22:21:06 +00:00
|
|
|
# Slash commands
|
|
|
|
|
|
|
|
|
|
|
|
@bot.slash_command()
|
|
|
|
async def help(ctx: discord.ApplicationContext):
|
|
|
|
await ctx.respond(HELP_MESSAGE)
|
|
|
|
|
2023-02-22 17:41:33 +00:00
|
|
|
# Commands
|
|
|
|
|
|
|
|
|
2023-02-25 22:21:06 +00:00
|
|
|
async def gif_command_handler(message: discord.Message, command: list[str]):
|
2023-02-23 18:24:42 +00:00
|
|
|
command_typed = command[0]
|
2023-02-22 17:46:54 +00:00
|
|
|
|
2023-02-22 19:48:02 +00:00
|
|
|
target = message.author.name
|
2023-02-24 18:56:51 +00:00
|
|
|
sender = message.author.name
|
2023-02-22 19:52:19 +00:00
|
|
|
if len(message.mentions) > 0:
|
2023-02-22 19:48:02 +00:00
|
|
|
target = message.mentions[0].name
|
2023-02-22 17:41:33 +00:00
|
|
|
|
2023-02-23 18:24:42 +00:00
|
|
|
if command_typed == "help":
|
|
|
|
await message.reply(HELP_MESSAGE)
|
2023-02-24 18:56:51 +00:00
|
|
|
return
|
2023-02-23 18:24:42 +00:00
|
|
|
|
|
|
|
if command_typed not in gifs:
|
2023-02-22 17:41:33 +00:00
|
|
|
await message.reply(
|
2023-02-22 17:46:54 +00:00
|
|
|
"im so sorry, i have no such thing to give you for now... come back later :3")
|
2023-02-22 20:59:46 +00:00
|
|
|
return
|
2023-02-22 17:41:33 +00:00
|
|
|
|
2023-02-23 18:24:42 +00:00
|
|
|
choosen_gif = random.choice(gifs[command_typed])
|
2023-02-24 18:56:51 +00:00
|
|
|
choosen_line = random.choice(lines[command_typed])
|
|
|
|
choosen_line = choosen_line.replace("$1", sender)
|
|
|
|
choosen_line = choosen_line.replace("$2", target)
|
|
|
|
await message.reply(f"{choosen_line}\n{choosen_gif}")
|
2023-02-22 17:41:33 +00:00
|
|
|
|
2023-02-25 22:21:06 +00:00
|
|
|
GIF_COMMANDS = [
|
2023-02-22 17:46:54 +00:00
|
|
|
"hug",
|
|
|
|
"kiss",
|
|
|
|
"cuddle",
|
|
|
|
"hold",
|
2023-02-22 17:50:01 +00:00
|
|
|
"pat",
|
2023-02-23 18:24:42 +00:00
|
|
|
"wag",
|
|
|
|
"fuck",
|
|
|
|
"blush",
|
|
|
|
"lewd",
|
|
|
|
"boop",
|
2023-02-22 17:46:54 +00:00
|
|
|
]
|
2023-02-22 17:41:33 +00:00
|
|
|
|
|
|
|
# Discord events
|
|
|
|
|
|
|
|
|
2023-02-24 19:31:53 +00:00
|
|
|
@bot.event
|
2023-02-22 17:41:33 +00:00
|
|
|
async def on_message(message: discord.Message):
|
|
|
|
if message.author.bot == True:
|
|
|
|
return
|
|
|
|
|
|
|
|
# TODO: Do proper parsing of the message
|
|
|
|
message_as_command = message.content.split(" ")
|
|
|
|
|
|
|
|
command = message_as_command[0]
|
2023-02-25 22:21:06 +00:00
|
|
|
if command in GIF_COMMANDS:
|
|
|
|
await gif_command_handler(message, message_as_command)
|
2023-02-22 17:41:33 +00:00
|
|
|
|
|
|
|
|
2023-02-24 19:31:53 +00:00
|
|
|
bot.run(open("token").read())
|