96 lines
2.2 KiB
Python
96 lines
2.2 KiB
Python
import random
|
|
import os
|
|
import secrets
|
|
import io
|
|
|
|
import emoji
|
|
import discord
|
|
from discord.ext import commands
|
|
from dotenv import load_dotenv
|
|
|
|
from googledoccy import jackblack
|
|
|
|
load_dotenv()
|
|
TOKEN = os.getenv("TOKEN")
|
|
|
|
intents = discord.Intents.default()
|
|
|
|
bot = commands.Bot(command_prefix=commands.when_mentioned_or("!"), intents=intents)
|
|
|
|
footer = "Chat now with your own personalized AI assistant! <https://bit.ly/4dz9g8S>"
|
|
|
|
def emojer():
|
|
e = []
|
|
all_emojis = emoji.EMOJI_DATA
|
|
for em in all_emojis:
|
|
e.append(em)
|
|
moji = random.choices(e, k=3)
|
|
return " ".join(moji)
|
|
|
|
def fuit_response():
|
|
vid = secrets.choice(os.listdir("./assets/vid/"))
|
|
path = f"./assets/vid/{vid}"
|
|
#with open(path, "rb") as ourfile:
|
|
return path
|
|
|
|
async def doccy_response():
|
|
doccy = jackblack()
|
|
#print(doccy)
|
|
resp = secrets.choice(doccy)
|
|
return resp
|
|
|
|
|
|
async def build_response():
|
|
|
|
fuit = fuit_response()
|
|
emoji_response = emojer()
|
|
doccy = await doccy_response()
|
|
|
|
if random.randint(0, 9) == 1:
|
|
if random.randint(0,1):
|
|
resps = emoji_response
|
|
else:
|
|
resps = fuit
|
|
else:
|
|
resps = doccy
|
|
|
|
#return str(secrets.choice(resps))
|
|
return resps
|
|
|
|
async def video_response():
|
|
pass
|
|
|
|
@bot.command()
|
|
async def d20(ctx):
|
|
await ctx.send(f'Rolled 🎲 {random.randint(1, 20)}')
|
|
|
|
@bot.event
|
|
async def on_message(message):
|
|
if bot.user.mentioned_in(message):
|
|
if random.randint(0, 10) == 5:
|
|
pass
|
|
|
|
response = await build_response()
|
|
|
|
try:
|
|
await message.channel.send(file=discord.File(response))
|
|
except:
|
|
if response.startswith("<https://"):
|
|
pass
|
|
if response.isupper():
|
|
pass
|
|
if response.startswith("<"):
|
|
await message.channel.send(f"{response}")
|
|
elif response.startswith(":"):
|
|
await message.channel.send(f"{response}")
|
|
elif random.randint(1, 5) == 1:
|
|
await message.channel.send(f"{response}\n\n\n{footer}")
|
|
else:
|
|
await message.channel.send(f"{response}")
|
|
|
|
await bot.process_commands(message)
|
|
|
|
bot.load_extension('jishaku')
|
|
bot.run(TOKEN)
|
|
|