[REPO REFACTOR]: changed to a better git repository structure with branches
1
resources/files/counter.csv
Normal file
@@ -0,0 +1 @@
|
||||
1
|
||||
|
60
resources/files/grupos.txt
Normal file
@@ -0,0 +1,60 @@
|
||||
Imagine Dragons
|
||||
Lil Nas X
|
||||
Ed Sheeran
|
||||
OneRepublic
|
||||
Harry Styles
|
||||
Mägo de Oz
|
||||
Black Eyed Peas
|
||||
Måneskin
|
||||
BoyWithUke
|
||||
Bad Bunny
|
||||
Bizarrap
|
||||
The Score
|
||||
bbno$
|
||||
The Weeknd
|
||||
Green Day
|
||||
Queen
|
||||
AC/DC
|
||||
Elton John
|
||||
Coldplay
|
||||
LiSA
|
||||
Glass Animals
|
||||
Post Malone
|
||||
KSI
|
||||
Cardi B
|
||||
JBalvin
|
||||
Marshmello
|
||||
Farruko
|
||||
Dua Lipa
|
||||
Ava Max
|
||||
Armin van Buuren
|
||||
Panic! At The Disco
|
||||
Billie Eilish
|
||||
Alan Walker
|
||||
Bebe Rexha
|
||||
Bruno Mars
|
||||
Miley Cyrus
|
||||
Maroon 5
|
||||
Tones And I
|
||||
Why don't we
|
||||
Ali Gatie
|
||||
Canserbero
|
||||
Residente
|
||||
Dire Straits
|
||||
Pink Floyd
|
||||
Prince
|
||||
The Police
|
||||
Guns N' Roses
|
||||
Linkin Park
|
||||
Scorpion
|
||||
Status Quo
|
||||
Justin Bieber
|
||||
Michael Jackson
|
||||
Ariana Grande
|
||||
Beyoncé
|
||||
Lady Gaga
|
||||
Katy Perry
|
||||
Adele
|
||||
Drake
|
||||
Taylor Swift
|
||||
Rihanna
|
||||
0
resources/files/hugs.json
Normal file
60
resources/files/juegos.txt
Normal file
@@ -0,0 +1,60 @@
|
||||
Dishonored 2
|
||||
The Witness
|
||||
Journey
|
||||
Uncharted 2: Among Thieves
|
||||
Overwatch
|
||||
Apex Legends
|
||||
Hollow Knig
|
||||
Ms. Pac-Man
|
||||
Counter-Strike 1.6
|
||||
Left 4 Dead 2
|
||||
EarthBound
|
||||
Diablo II
|
||||
StarCraft
|
||||
World of Warcraft
|
||||
Star Wars: Knights of the Old Republic
|
||||
Fallout: New Vegas
|
||||
Final Fantasy VI
|
||||
Pokémon Yellow
|
||||
Metroid Prime
|
||||
The Elder Scrolls V: Skyrim
|
||||
Resident Evil 4
|
||||
Shadow of the Colossus
|
||||
The Last of Us Part 2
|
||||
Red Dead Redemption
|
||||
Metal Gear Solid
|
||||
Sid Meier's Civilization IV
|
||||
The Legend of Zelda: Ocarina of Time
|
||||
Minecraft
|
||||
Halo: Combat Evolved
|
||||
Half-Life
|
||||
Final Fantasy XIV
|
||||
Doom
|
||||
Tetris
|
||||
Metal Gear Solid 3: Snake Eater
|
||||
Half-Life: Alyx
|
||||
God of War
|
||||
Chrono Trigger
|
||||
Portal
|
||||
Street Fighter II
|
||||
Super Mario Bros.
|
||||
Undertale
|
||||
Bloodborne
|
||||
BioShock
|
||||
The Last of Us
|
||||
The Witcher 3: Wild Hunt
|
||||
Halo 2
|
||||
Castlevania: Symphony of the Night
|
||||
Hades
|
||||
Grand Theft Auto V
|
||||
Super Mario Bros. 3
|
||||
Disco Elysium
|
||||
Half-Life 2
|
||||
Red Dead Redemption 2
|
||||
Super Mario 64
|
||||
Mass Effect 2
|
||||
Super Metroid
|
||||
The Legend of Zelda: A Link to the Past
|
||||
Portal 2
|
||||
Super Mario World
|
||||
The Legend of Zelda: Breath of the Wild
|
||||
60
resources/files/shows.txt
Normal file
@@ -0,0 +1,60 @@
|
||||
Squid Game
|
||||
La Casa de Papel
|
||||
Lupin
|
||||
Avatar
|
||||
Los Simpson
|
||||
Lightyear
|
||||
Tadeo Jones
|
||||
Los Minions
|
||||
Doraemon
|
||||
Shin-Chan
|
||||
JoJo's Bizarre Adventures
|
||||
Boku no Hero Academia
|
||||
Fullmetal Alchemist
|
||||
SPY X FAMILY
|
||||
Black Clover
|
||||
My Dress-up Darling
|
||||
New Amsterdam
|
||||
Death Note
|
||||
Cobra Kai
|
||||
Karate Kid
|
||||
Interstellar
|
||||
Cómo entrenar a tu dragón
|
||||
Free Guy
|
||||
Spider Man
|
||||
Dr Strange
|
||||
Matrix
|
||||
John Wick
|
||||
Iron Man
|
||||
The Good Doctor
|
||||
Komi-san can't communicate
|
||||
Big Mouth
|
||||
(Des)encanto
|
||||
Rick y Morty
|
||||
Historias Corrientes
|
||||
Hora de Aventuras
|
||||
Chowder
|
||||
Star Trek
|
||||
Star Wars
|
||||
Lost in Space
|
||||
Tokyo Revengers
|
||||
Gladiator
|
||||
The Crown
|
||||
Peaky Blinders
|
||||
Sex Education
|
||||
Enola Holmes
|
||||
Los Juegos del Hambre
|
||||
Juego de Tronos
|
||||
El Señor de los Anillos
|
||||
La princesa mononoke
|
||||
Hitman
|
||||
Los Croods
|
||||
Plan de Escape
|
||||
Código Lyoko
|
||||
El Padrino
|
||||
El viaje de Chihiro
|
||||
El castillo ambulante
|
||||
Coach Carter
|
||||
Mascotas
|
||||
Aida
|
||||
La que se avecina
|
||||
0
resources/files/warns.json
Normal file
BIN
resources/images/djpype.png
Normal file
|
After Width: | Height: | Size: 224 KiB |
BIN
resources/images/interaction/beber.gif
Normal file
|
After Width: | Height: | Size: 1.3 MiB |
BIN
resources/images/interaction/bombardeen.gif
Normal file
|
After Width: | Height: | Size: 2.4 MiB |
BIN
resources/images/interaction/dale al play.webm
Normal file
BIN
resources/images/interaction/fbi.gif
Normal file
|
After Width: | Height: | Size: 262 KiB |
BIN
resources/images/interaction/femboy.png
Normal file
|
After Width: | Height: | Size: 105 KiB |
BIN
resources/images/interaction/moan.gif
Normal file
|
After Width: | Height: | Size: 1.7 MiB |
BIN
resources/images/interaction/oooh.gif
Normal file
|
After Width: | Height: | Size: 258 KiB |
BIN
resources/images/interaction/paredes.gif
Normal file
|
After Width: | Height: | Size: 2.0 MiB |
BIN
resources/images/interaction/run.gif
Normal file
|
After Width: | Height: | Size: 833 KiB |
BIN
resources/images/interaction/ship.gif
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
resources/images/interaction/spank.gif
Normal file
|
After Width: | Height: | Size: 3.4 MiB |
BIN
resources/images/logo.png
Normal file
|
After Width: | Height: | Size: 2.6 MiB |
BIN
resources/images/pype.png
Normal file
|
After Width: | Height: | Size: 163 KiB |
22
src/bot.py
Normal file
@@ -0,0 +1,22 @@
|
||||
import discord
|
||||
from settings import BOT_TOKEN
|
||||
from os import listdir
|
||||
from utils.logger.pype_logger import PypeLogger
|
||||
|
||||
bot = discord.Bot(intents=discord.Intents.all())
|
||||
|
||||
def load_cogs():
|
||||
for file in listdir("./cogs"):
|
||||
if(file.endswith(".py")):
|
||||
try:
|
||||
bot.load_extension(f"cogs.{file[:-3]}")
|
||||
PypeLogger.info(f"{file[:-3]} has been loaded")
|
||||
except Exception as e:
|
||||
PypeLogger.error(f"Error loading {file[:-3]}",e)
|
||||
|
||||
def main():
|
||||
load_cogs()
|
||||
bot.run(BOT_TOKEN)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
227
src/cogs/admin.py
Normal file
@@ -0,0 +1,227 @@
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
from discord.commands import SlashCommandGroup
|
||||
from settings import EMBED_COLOR, GUILD_IDS, ADMIN_ROLE_ID, ANNOUNCES_CHANNEL_ID, TIMEZONE
|
||||
from utils.embeds import crear_embed
|
||||
from utils.logger.pype_logger import PypeLogger
|
||||
from utils.files import read_json, write_json
|
||||
from utils.reactions import añadir_reacciones
|
||||
from datetime import datetime
|
||||
import pytz
|
||||
import json
|
||||
|
||||
class Admin(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self._last_member = None
|
||||
|
||||
admin = SlashCommandGroup(
|
||||
name="admin",
|
||||
description="Comandos de administración",
|
||||
guild_ids=GUILD_IDS
|
||||
)
|
||||
|
||||
@admin.command(name="anuncio", guild_ids=GUILD_IDS, description="Anuncia algo.")
|
||||
async def anuncio(self, ctx, *, mensaje) -> None:
|
||||
embed = discord.Embed(color=discord.Color(EMBED_COLOR))
|
||||
embed.add_field(name="📢** | Anuncio**", value=mensaje)
|
||||
if ctx.author.guild.get_role(ADMIN_ROLE_ID) in ctx.author.roles:
|
||||
channel = ctx.guild.get_channel(ANNOUNCES_CHANNEL_ID)
|
||||
await channel.send(embed=embed)
|
||||
await ctx.respond(f"Se ha anunciado el mensaje, {ctx.author.mention} ", ephemeral=True)
|
||||
else:
|
||||
await ctx.respond(f"No tienes permisos para eso, {ctx.author.mention} ", ephemeral=True)
|
||||
|
||||
# crea un embed con fields, footer, image, thumbnail, author, title, description, color, timestamp a elegir
|
||||
@admin.command(name="embed", guild_ids=GUILD_IDS, description="Crea un embed.")
|
||||
async def create_embed(self, ctx: commands.Context, *,
|
||||
title: str,
|
||||
description: str,
|
||||
fields: str = None,
|
||||
footer_text: str = None,
|
||||
timestamp: bool = False,
|
||||
author_name: str = None,
|
||||
image_url: str = None,
|
||||
thumbnail_url: str = None,
|
||||
color: int = None) -> None:
|
||||
embed = crear_embed(ctx,title,description,fields,footer_text,timestamp,author_name,image_url,thumbnail_url,color)
|
||||
await ctx.send(embed=embed)
|
||||
await ctx.respond(f"Se ha creado el embed, {ctx.author.mention} ", ephemeral=True)
|
||||
|
||||
|
||||
@admin.command(name='ban', guild_ids=GUILD_IDS, description="Alza el martillo del ban.")
|
||||
async def ban(self, ctx, *, miembro: discord.Member) -> None:
|
||||
embed = discord.Embed(color=discord.Color(EMBED_COLOR))
|
||||
embed.add_field(
|
||||
name="🚫** | BAN**", value=f"{miembro.mention} ha sido golpead@ por el martillo del Ban.")
|
||||
if ctx.author.guild.get_role(ADMIN_ROLE_ID) in ctx.author.roles:
|
||||
await ctx.respond(embed=embed)
|
||||
await miembro.ban()
|
||||
else:
|
||||
await ctx.respond(f"No tienes permisos para eso, {ctx.author.mention} ", ephemeral=True)
|
||||
|
||||
@admin.command(name='unban', guild_ids=GUILD_IDS, description="Baja el martillo del ban.")
|
||||
async def unban(self, ctx, *, miembro: discord.Member) -> None:
|
||||
embed = discord.Embed(color=discord.Color(EMBED_COLOR))
|
||||
embed.add_field(name="🚫** | UNBAN**",
|
||||
value=f"{miembro.name} se ha recuperado del martillazo.")
|
||||
if ctx.author.guild.get_role(ADMIN_ROLE_ID) in ctx.author.roles:
|
||||
await ctx.respond(embed=embed)
|
||||
await miembro.unban()
|
||||
else:
|
||||
await ctx.respond(f"No tienes permisos para eso, {ctx.author.mention} ", ephemeral=True)
|
||||
|
||||
@admin.command(name='kick', guild_ids=GUILD_IDS, description="Expulsa a un miembro.")
|
||||
async def kick(self, ctx, *, miembro: discord.Member, razon: str = "mal comportamiento") -> None:
|
||||
embed = discord.Embed(color=discord.Color(EMBED_COLOR))
|
||||
embed.add_field(
|
||||
name="🦵🏽** | KICK**", value=f"{miembro.mention} ha sido expulsado por: {razon}.")
|
||||
if ctx.author.guild.get_role(ADMIN_ROLE_ID) in ctx.author.roles:
|
||||
await ctx.respond(embed=embed)
|
||||
await miembro.kick(reason=razon)
|
||||
else:
|
||||
await ctx.respond(f"No tienes permisos para eso, {ctx.author.mention} ", ephemeral=True)
|
||||
|
||||
@admin.command(name="mute", guild_ids=GUILD_IDS, description="Silencia a un miembro.")
|
||||
async def mute(self, ctx, *, miembro: discord.Member) -> None:
|
||||
embed = discord.Embed(color=discord.Color(EMBED_COLOR))
|
||||
embed.add_field(
|
||||
name="🔇** | MUTE**", value=f"{miembro.mention} ha sido silenciad@.")
|
||||
if ctx.author.guild.get_role(ADMIN_ROLE_ID) in ctx.author.roles:
|
||||
await ctx.respond(embed=embed)
|
||||
await miembro.edit(mute=True)
|
||||
else:
|
||||
await ctx.respond(f"No tienes permisos para eso, {ctx.author.mention} ", ephemeral=True)
|
||||
|
||||
@admin.command(name="unmute", guild_ids=GUILD_IDS, description="Desilencia a un miembro.")
|
||||
async def unmute(self, ctx, *, miembro: discord.Member) -> None:
|
||||
embed = discord.Embed(color=discord.Color(EMBED_COLOR))
|
||||
embed.add_field(
|
||||
name="🔊** | UNMUTE**", value=f"{miembro.mention} ha sido desilenciad@.")
|
||||
if ctx.author.guild.get_role(ADMIN_ROLE_ID) in ctx.author.roles:
|
||||
await ctx.respond(embed=embed)
|
||||
await miembro.edit(mute=False)
|
||||
else:
|
||||
await ctx.respond(f"No tienes permisos para eso, {ctx.author.mention} ", ephemeral=True)
|
||||
|
||||
@admin.command(name="clearch", guild_ids=GUILD_IDS, description="Borra mensajes.")
|
||||
async def clear(self, ctx, cantidad: int) -> None:
|
||||
if ctx.author.guild.get_role(ADMIN_ROLE_ID) in ctx.author.roles:
|
||||
await ctx.respond(f"Se han limpiado {cantidad} mensajes, {ctx.author.mention}", ephemeral=True)
|
||||
await ctx.channel.purge(limit=cantidad)
|
||||
else:
|
||||
await ctx.respond(f"No tienes permisos para eso, {ctx.author.mention} ", ephemeral=True)
|
||||
|
||||
@admin.command(name="lock", guild_ids=GUILD_IDS, description="Bloquea un canal.")
|
||||
async def lock(self, ctx) -> None:
|
||||
if ctx.author.guild.get_role(ADMIN_ROLE_ID) in ctx.author.roles:
|
||||
await ctx.respond(f"Se ha bloqueado el canal, {ctx.author.mention}", ephemeral=True)
|
||||
await ctx.channel.set_permissions(ctx.guild.default_role, send_messages=False)
|
||||
else:
|
||||
await ctx.respond(f"No tienes permisos para eso, {ctx.author.mention} ", ephemeral=True)
|
||||
|
||||
@admin.command(name="unlock", guild_ids=GUILD_IDS, description="Desbloquea un canal.")
|
||||
async def unlock(self, ctx) -> None:
|
||||
if ctx.author.guild.get_role(ADMIN_ROLE_ID) in ctx.author.roles:
|
||||
await ctx.respond(f"Se ha desbloqueado el canal, {ctx.author.mention}", ephemeral=True)
|
||||
await ctx.channel.set_permissions(ctx.guild.default_role, send_messages=True)
|
||||
else:
|
||||
await ctx.respond(f"No tienes permisos para eso, {ctx.author.mention} ", ephemeral=True)
|
||||
|
||||
@admin.command(name="nick", guild_ids=GUILD_IDS, description="Cambia el apodo de un miembro.")
|
||||
async def nick(self, ctx, miembro: discord.Member, *, apodo: str) -> None:
|
||||
if ctx.author.guild.get_role(ADMIN_ROLE_ID) in ctx.author.roles:
|
||||
await ctx.respond(f"Se ha cambiado el apodo de {miembro.mention} a {apodo}, {ctx.author.mention}", ephemeral=True)
|
||||
await miembro.edit(nick=apodo)
|
||||
else:
|
||||
await ctx.respond(f"No tienes permisos para eso, {ctx.author.mention} ", ephemeral=True)
|
||||
|
||||
@admin.command(name="role", guild_ids=GUILD_IDS, description="Añade o quita un rol a un miembro.")
|
||||
async def role(self, ctx, miembro: discord.Member, *, rol: discord.Role) -> None:
|
||||
if ctx.author.guild.get_role(ADMIN_ROLE_ID) in ctx.author.roles:
|
||||
if rol in miembro.roles:
|
||||
await ctx.respond(f"Se ha quitado el rol {rol.mention} a {miembro.mention}, {ctx.author.mention}", ephemeral=True)
|
||||
await miembro.remove_roles(rol)
|
||||
else:
|
||||
await ctx.respond(f"Se ha añadido el rol {rol.mention} a {miembro.mention}, {ctx.author.mention}", ephemeral=True)
|
||||
await miembro.add_roles(rol)
|
||||
else:
|
||||
await ctx.respond(f"No tienes permisos para eso, {ctx.author.mention} ", ephemeral=True)
|
||||
|
||||
@admin.command(name='votacion', guild_ids=GUILD_IDS, description="Crea una votación.")
|
||||
async def votacion(self, ctx, *, pregunta, reacciones, tiempo = None) -> None:
|
||||
if ctx.author.guild.get_role(ADMIN_ROLE_ID) in ctx.author.roles:
|
||||
emojis = "1\uFE0F\u20E3;2\uFE0F\u20E3;3\uFE0F\u20E3;4\uFE0F\u20E3;5\uFE0F\u20E3;6\uFE0F\u20E3;7\uFE0F\u20E3;8\uFE0F\u20E3;9\uFE0F\u20E3"
|
||||
emojis_list = emojis.split(";")
|
||||
if tiempo:
|
||||
embed = discord.Embed(title=pregunta, description=f"Acaba en {tiempo}", color=discord.Color(EMBED_COLOR))
|
||||
else:
|
||||
embed = discord.Embed(title=pregunta, description="", color=discord.Color(EMBED_COLOR))
|
||||
reacciones = reacciones.split(",")
|
||||
a=0
|
||||
for r in reacciones:
|
||||
embed.add_field(name=f"{emojis_list[a]} : {r}", value="", inline=False)
|
||||
a+=1
|
||||
embed.set_author(name=f"Votación 📊", icon_url=ctx.author.avatar.url)
|
||||
embed.set_footer(text=f"Concord")
|
||||
embed.timestamp = datetime.now(pytz.timezone(TIMEZONE))
|
||||
msg = await ctx.send(embed=embed)
|
||||
await añadir_reacciones(msg, emojis, len(reacciones))
|
||||
await ctx.respond(f"Se ha creado la votación, {ctx.author.mention}", ephemeral=True)
|
||||
else:
|
||||
await ctx.respond(f"No tienes permisos para eso, {ctx.author.mention} ", ephemeral=True)
|
||||
|
||||
@admin.command(name='warn', guild_ids=GUILD_IDS, description="Añade una advertencia a un miembro.")
|
||||
async def warn(self, ctx, miembro: discord.Member, *, razon) -> None:
|
||||
warned_users = read_json("../resources/files/warns.json")
|
||||
if ctx.author.guild.get_role(ADMIN_ROLE_ID) in ctx.author.roles:
|
||||
embed = discord.Embed(color=discord.Color(EMBED_COLOR))
|
||||
embed.add_field(
|
||||
name="⚠️** | WARN**", value=f"{miembro.mention} ha sido advertid@ por {razon}.")
|
||||
|
||||
await ctx.respond(embed=embed)
|
||||
await miembro.send(f"Has sido advertid@ en {ctx.guild.name} por {razon}.")
|
||||
|
||||
key = str(miembro.id)
|
||||
if key not in warned_users.keys():
|
||||
warned_users[key] = 1
|
||||
elif key in warned_users.keys():
|
||||
warned_users[key]+=1
|
||||
|
||||
warnsfile = "../resources/files/warns.json"
|
||||
|
||||
write_json(warnsfile, warned_users)
|
||||
|
||||
else:
|
||||
await ctx.respond(f"No tienes permisos para eso, {ctx.author.mention} ", ephemeral=True)
|
||||
|
||||
@admin.command(name='warns', guild_ids=GUILD_IDS, description="Muestra las advertencias de un miembro.")
|
||||
async def warns(self, ctx, miembro: discord.Member) -> None:
|
||||
warned_users = read_json("../resources/files/warns.json")
|
||||
if ctx.author.guild.get_role(ADMIN_ROLE_ID) in ctx.author.roles:
|
||||
embed = discord.Embed(color=discord.Color(EMBED_COLOR))
|
||||
embed.add_field(
|
||||
name="⚠️** | WARN**", value=f"{miembro.mention} tiene {warned_users[str(miembro.id)]} advertencias.")
|
||||
await ctx.respond(embed=embed, ephemeral=True)
|
||||
else:
|
||||
await ctx.respond(f"No tienes permisos para eso, {ctx.author.mention} ", ephemeral=True)
|
||||
|
||||
@admin.command(name='clearwarns', guild_ids=GUILD_IDS, description="Elimina las advertencias de un miembro.")
|
||||
async def clearwarns(self, ctx, miembro: discord.Member) -> None:
|
||||
warned_users = read_json("../resources/files/warns.json")
|
||||
if ctx.author.guild.get_role(ADMIN_ROLE_ID) in ctx.author.roles:
|
||||
embed = discord.Embed(color=discord.Color(EMBED_COLOR))
|
||||
embed.add_field(
|
||||
name="⚠️** | WARN**", value=f"{miembro.mention} ha sido desadvertid@.")
|
||||
|
||||
await ctx.respond(embed=embed, ephemeral=True)
|
||||
|
||||
warned_users[str(miembro.id)] = 0
|
||||
warnsfile = "../resources/files/warns.json"
|
||||
|
||||
write_json(warnsfile, warned_users)
|
||||
else:
|
||||
await ctx.respond(f"No tienes permisos para eso, {ctx.author.mention} ", ephemeral=True)
|
||||
|
||||
def setup(bot) -> None:
|
||||
bot.add_cog(Admin(bot))
|
||||
83
src/cogs/events.py
Normal file
@@ -0,0 +1,83 @@
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
from settings import (
|
||||
EMBED_COLOR, BOT_NAME, ADMIN_CHANNEL_ID, BOT_LOGO, COUNTER_CHANNEL_ID,
|
||||
WELCOME_CHANNEL_ID, UNVERIFIED_ROLE_ID, VERIFIED_ROLE_ID
|
||||
)
|
||||
from utils.logger.pype_logger import PypeLogger
|
||||
import asyncio
|
||||
from utils.bot import bot_status_randomizer
|
||||
from utils.files import read, write
|
||||
|
||||
class Events(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self._last_member = None
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_ready(self):
|
||||
PypeLogger.success(f"Logged in as {self.bot.user.name}#{self.bot.user.discriminator}")
|
||||
channel = self.bot.get_channel(ADMIN_CHANNEL_ID)
|
||||
embed = discord.Embed(title = f"{BOT_NAME} Console",
|
||||
description = "```✅ | Logged in as Pype#6125\n🐍 | Estoy listo pa\n🐍 | >>>```",
|
||||
color=discord.Color(EMBED_COLOR))
|
||||
await channel.send(embed=embed)
|
||||
await self.bot.user.edit(avatar=open("../"+BOT_LOGO, "rb").read())
|
||||
while True:
|
||||
await self.bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching,
|
||||
name=bot_status_randomizer("../resources/files/shows.txt")))
|
||||
await asyncio.sleep(60)
|
||||
await self.bot.change_presence(activity=discord.Activity(type=discord.ActivityType.playing,
|
||||
name=bot_status_randomizer("../resources/files/juegos.txt")))
|
||||
await asyncio.sleep(60)
|
||||
await self.bot.change_presence(activity=discord.Activity(type=discord.ActivityType.listening,
|
||||
name=bot_status_randomizer("../resources/files/grupos.txt")))
|
||||
await asyncio.sleep(60)
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_message(self, message: discord.Message):
|
||||
if message.author != self.bot.user:
|
||||
if message.channel.id == COUNTER_CHANNEL_ID:
|
||||
if message.author != self._last_member:
|
||||
try:
|
||||
# Evaluar el contenido del mensaje como una expresión matemática
|
||||
numero = int(eval(message.content))
|
||||
file = "../resources/files/counter.csv"
|
||||
n = int(read(file))
|
||||
|
||||
if numero == n + 1:
|
||||
await message.add_reaction("✅")
|
||||
self._last_member = message.author
|
||||
n += 1
|
||||
write(file, str(n))
|
||||
else:
|
||||
await message.add_reaction("❌")
|
||||
await message.channel.send(f"{message.author.mention} falló, reseteando el contador.")
|
||||
write(file, "0")
|
||||
except (ValueError, SyntaxError):
|
||||
await message.delete()
|
||||
else:
|
||||
await message.delete()
|
||||
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_member_join(self, member):
|
||||
bienvenidas = self.bot.get_channel(WELCOME_CHANNEL_ID)
|
||||
"""defaultrole = member.guild.get_role(UNVERIFIED_ROLE_ID)
|
||||
verifiedrole = member.guild.get_role(VERIFIED_ROLE_ID)
|
||||
if member.guild.get_role(VERIFIED_ROLE_ID) in member.roles:
|
||||
await member.remove_roles(verifiedrole)
|
||||
await member.add_roles(defaultrole)"""
|
||||
await bienvenidas.send(f"¡Bienvenido {member.mention}! Espero que te lo pases bien en el servidor. Recuerda leer las <#1092518793143652352> para evitar ser sancionado. ¡Diviértete! :D")
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_member_leave(self, after):
|
||||
adminchannel = self.bot.get_channel(ADMIN_CHANNEL_ID)
|
||||
await adminchannel.send(f"**{after.name}** ha abandonado el servidor")
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_application_command(self, ctx):
|
||||
PypeLogger.command(f"{ctx.author} ha ejecutado el comando {ctx.command} en {ctx.guild.name}.")
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(Events(bot))
|
||||
71
src/cogs/help.py
Normal file
@@ -0,0 +1,71 @@
|
||||
import discord
|
||||
from discord.ext import commands, pages
|
||||
from discord.commands import SlashCommandGroup
|
||||
from settings import (
|
||||
EMBED_COLOR, GUILD_IDS, INDICE, VARIOS,
|
||||
INTERACCION, INTERACCION_2, NSFW, MATEMATICAS, MUSICA, VERIFICACION, HELP
|
||||
)
|
||||
|
||||
class Help(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
help = SlashCommandGroup("help", "Comandos de Ayuda", guild_ids=GUILD_IDS)
|
||||
|
||||
@help.command(name="all", guild_ids=GUILD_IDS, description="Abre el menú de ayuda de comandos.")
|
||||
async def all(self, ctx: discord.ApplicationContext):
|
||||
indice_embed = discord.Embed(
|
||||
title="**📖 | MENÚ DE COMANDOS**", color=discord.Color(EMBED_COLOR))
|
||||
indice_embed.add_field(name="**📝 | Categorías**", value=INDICE)
|
||||
|
||||
varios_embed = discord.Embed(
|
||||
title="**📖 | MENÚ DE COMANDOS**", color=discord.Color(EMBED_COLOR))
|
||||
varios_embed.add_field(name="**🪶 | Varios**", value=VARIOS)
|
||||
|
||||
interaccion_embed = discord.Embed(
|
||||
title="**📖 | MENÚ DE COMANDOS**", color=discord.Color(EMBED_COLOR))
|
||||
interaccion_embed.add_field(
|
||||
name="**👥 | Interacción**", value=INTERACCION, inline=False)
|
||||
interaccion_embed.add_field(
|
||||
name="**👥 | Interacción**", value=INTERACCION_2, inline=False)
|
||||
|
||||
nsfw_embed = discord.Embed(
|
||||
title="**📖 | MENÚ DE COMANDOS**", color=discord.Color(EMBED_COLOR))
|
||||
nsfw_embed.add_field(name="**🔞 | NSFW**", value=NSFW)
|
||||
|
||||
matematicas_embed = discord.Embed(
|
||||
title="**📖 | MENÚ DE COMANDOS**", color=discord.Color(EMBED_COLOR))
|
||||
matematicas_embed.add_field(
|
||||
name="**🧮 | Matemáticas**", value=MATEMATICAS)
|
||||
|
||||
musica_embed = discord.Embed(
|
||||
title="**📖 | MENÚ DE COMANDOS**", color=discord.Color(EMBED_COLOR))
|
||||
musica_embed.add_field(name="**🎶 | Música**", value=MUSICA)
|
||||
|
||||
verificacion_embed = discord.Embed(
|
||||
title="**📖 | MENÚ DE COMANDOS**", color=discord.Color(EMBED_COLOR))
|
||||
verificacion_embed.add_field(
|
||||
name="**✅ | Verificación**", value=VERIFICACION)
|
||||
|
||||
help_embed = discord.Embed(
|
||||
title="**📖 | MENÚ DE COMANDOS**", color=discord.Color(EMBED_COLOR))
|
||||
help_embed.add_field(name="**🆘 | Ayuda**", value=HELP)
|
||||
|
||||
paginator = pages.Paginator(
|
||||
pages=[
|
||||
indice_embed,
|
||||
varios_embed,
|
||||
interaccion_embed,
|
||||
nsfw_embed,
|
||||
matematicas_embed,
|
||||
musica_embed,
|
||||
verificacion_embed,
|
||||
help_embed
|
||||
],
|
||||
loop_pages=True
|
||||
)
|
||||
await paginator.respond(ctx.interaction, ephemeral=False)
|
||||
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(Help(bot))
|
||||
207
src/cogs/interaction.py
Normal file
@@ -0,0 +1,207 @@
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
from discord.commands import SlashCommandGroup
|
||||
import hmtai
|
||||
import random
|
||||
import json
|
||||
from settings import GUILD_IDS, EMBED_COLOR
|
||||
from utils.files import read_json
|
||||
|
||||
class Interaccion(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self._last_member = None
|
||||
|
||||
inter = SlashCommandGroup("inter", "Comandos de Interacción", guild_ids=GUILD_IDS)
|
||||
|
||||
@inter.command(name='wave', guild_ids=GUILD_IDS, description="Saluda a alguien.")
|
||||
async def wave(self, ctx, *, miembro: discord.Member):
|
||||
embed = discord.Embed(
|
||||
description=f"{ctx.author.mention} saludó a {miembro.mention}.", color=discord.Color(EMBED_COLOR))
|
||||
embed.set_image(url=hmtai.get("hmtai", "wave"))
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@inter.command(name='dance', guild_ids=GUILD_IDS, description="Saca los pasos prohibidos.")
|
||||
async def dance(self, ctx):
|
||||
embed = discord.Embed(
|
||||
description=f"{ctx.author.mention} se puso a bailar.", color=discord.Color(EMBED_COLOR))
|
||||
embed.set_image(url=hmtai.get("hmtai", "dance"))
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@inter.command(name='nice', guild_ids=GUILD_IDS, description="Di que te gusta.")
|
||||
async def nice(self, ctx):
|
||||
embed = discord.Embed(
|
||||
description=f"A {ctx.author.mention} le gustó eso.", color=discord.Color(EMBED_COLOR))
|
||||
embed.set_image(url=hmtai.get("hmtai", "like"))
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@inter.command(name='nosebleed', guild_ids=GUILD_IDS, description="OwO")
|
||||
async def nosebleed(self, ctx):
|
||||
embed = discord.Embed(
|
||||
description=f"{ctx.author.mention} empezó a sangrar por la nariz.", color=discord.Color(EMBED_COLOR))
|
||||
embed.set_image(url=hmtai.get("hmtai", "nosebleed"))
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@inter.command(name='punch', guild_ids=GUILD_IDS, description="ONE PUUUUUUUNCH.")
|
||||
async def punch(self, ctx, *, miembro: discord.Member):
|
||||
embed = discord.Embed(
|
||||
description=f"{ctx.author.mention} le dio un puñetazo a {miembro.mention}.", color=discord.Color(EMBED_COLOR))
|
||||
embed.set_image(url=hmtai.get("hmtai", "punch"))
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@inter.command(name='feed', guild_ids=GUILD_IDS, description="Ñam ñam.")
|
||||
async def feed(self, ctx, *, miembro: discord.Member):
|
||||
embed = discord.Embed(
|
||||
description=f"{ctx.author.mention} le dio de comer a {miembro.mention}.", color=discord.Color(EMBED_COLOR))
|
||||
embed.set_image(url=hmtai.get("hmtai", "feed"))
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@inter.command(name='tickle', guild_ids=GUILD_IDS, description="Tortura de la risa.")
|
||||
async def tickle(self, ctx, *, miembro: discord.Member):
|
||||
embed = discord.Embed(
|
||||
description=f"{ctx.author.mention} le hizo cosquillas a {miembro.mention}.", color=discord.Color(EMBED_COLOR))
|
||||
embed.set_image(url=hmtai.get("hmtai", "tickle"))
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@inter.command(name='bite', guild_ids=GUILD_IDS, description="Muerde a alguien.")
|
||||
async def bite(self, ctx, *, miembro: discord.Member):
|
||||
embed = discord.Embed(
|
||||
description=f"{ctx.author.mention} le dio un mordisco a {miembro.mention}.", color=discord.Color(EMBED_COLOR))
|
||||
embed.set_image(url=hmtai.get("hmtai", "bite"))
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@inter.command(name='hug', guild_ids=GUILD_IDS, description="Abraza a alguien.")
|
||||
async def hug(self, ctx, *, miembro: discord.Member):
|
||||
hugdata = read_json("../resources/files/hugs.json")
|
||||
key = str(miembro.id)
|
||||
if key not in hugdata.keys():
|
||||
hugdata[key] = 1
|
||||
elif key in hugdata.keys():
|
||||
hugdata[key]+=1
|
||||
with open("/home/container/data/hugs.json", 'w', encoding='utf8') as outfile:
|
||||
str_ = json.dumps(hugdata, indent=4, sort_keys=True, separators=(',', ': '), ensure_ascii=False)
|
||||
outfile.write(str_)
|
||||
|
||||
nabrazos = hugdata[str(miembro.id)]
|
||||
|
||||
embed = discord.Embed(
|
||||
description=f"{ctx.author.mention} le dio un abrazo a {miembro.mention}", color=discord.Color(EMBED_COLOR))
|
||||
embed.set_image(url=hmtai.get("hmtai", "hug"))
|
||||
embed.set_footer(text=f"{miembro.name} ha sido abrazado {nabrazos} veces.")
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@inter.command(name='kill', guild_ids=GUILD_IDS, description="Arrebátale la vida a alguien.")
|
||||
async def kill(self, ctx, *, miembro: discord.Member):
|
||||
embed = discord.Embed(
|
||||
description=f"{ctx.author.mention} asesinó a {miembro.mention}", color=discord.Color(EMBED_COLOR))
|
||||
embed.set_image(url=hmtai.get("hmtai", "kill"))
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@inter.command(name='kiss', guild_ids=GUILD_IDS, description="Cómele la boca a alguien.")
|
||||
async def kiss(self, ctx, *, miembro: discord.Member):
|
||||
embed = discord.Embed(
|
||||
description=f"{ctx.author.mention} le dio un beso a {miembro.mention} >.<", color=discord.Color(EMBED_COLOR))
|
||||
embed.set_image(url=hmtai.get("hmtai", "kiss"))
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@inter.command(name='pat', guild_ids=GUILD_IDS, description="Acaricia a alguien.")
|
||||
async def pat(self, ctx, *, miembro: discord.Member):
|
||||
embed = discord.Embed(
|
||||
description=f"{ctx.author.mention} acarició a {miembro.mention} UwU", color=discord.Color(EMBED_COLOR))
|
||||
embed.set_image(url=hmtai.get("hmtai", "pat"))
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@inter.command(name='slap', guild_ids=GUILD_IDS, description="Abofetea a alguien.")
|
||||
async def slap(self, ctx, *, miembro: discord.Member):
|
||||
embed = discord.Embed(
|
||||
description=f"{ctx.author.mention} le dio una bofetada a {miembro.mention} >:)", color=discord.Color(EMBED_COLOR))
|
||||
embed.set_image(url=hmtai.get("hmtai", "slap"))
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@inter.command(name='sleep', guild_ids=GUILD_IDS, description="A mimir.")
|
||||
async def sleep(self, ctx):
|
||||
embed = discord.Embed(
|
||||
description=f"{ctx.author.mention} se fue a mimir", color=discord.Color(EMBED_COLOR))
|
||||
embed.set_image(url=hmtai.get("hmtai", "sleep"))
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@inter.command(name='cry', guild_ids=GUILD_IDS, description="Expresa tu tristeza...")
|
||||
async def cry(self, ctx):
|
||||
embed = discord.Embed(
|
||||
description=f"{ctx.author.mention} se puso triste :(", color=discord.Color(EMBED_COLOR))
|
||||
embed.set_image(url=hmtai.get("hmtai", "cry"))
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@inter.command(name='cuddle', guild_ids=GUILD_IDS, description="Acurrúcate con alguien.")
|
||||
async def cuddle(self, ctx, *, miembro: discord.Member):
|
||||
embed = discord.Embed(
|
||||
description=f"{ctx.author.mention} se acurrucó con {miembro.mention}", color=discord.Color(EMBED_COLOR))
|
||||
embed.set_image(url=hmtai.get("hmtai", "cuddle"))
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@inter.command(name='lick', guild_ids=GUILD_IDS, description="Lámele a alguien. 7u7")
|
||||
async def lick(self, ctx, *, miembro: discord.Member):
|
||||
embed = discord.Embed(
|
||||
description=f"{ctx.author.mention} lamió sensualmente a {miembro.mention}", color=discord.Color(EMBED_COLOR))
|
||||
embed.set_image(url=hmtai.get("hmtai", "lick"))
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@inter.command(name='threaten', guild_ids=GUILD_IDS, description="Amenaza a alguien.")
|
||||
async def threaten(self, ctx, *, miembro: discord.Member):
|
||||
embed = discord.Embed(
|
||||
description=f"{ctx.author.mention} amenazó con cortarle la picha a {miembro.mention}", color=discord.Color(EMBED_COLOR))
|
||||
embed.set_image(url=hmtai.get("hmtai", "threaten"))
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@inter.command(name='femboy', guild_ids=GUILD_IDS, description="Femboiza a alguien.")
|
||||
async def femboy(self, ctx, *, miembro: discord.Member):
|
||||
embed = discord.Embed(
|
||||
description=f"{ctx.author.mention} ha convertido en femboy a {miembro.mention}", color=discord.Color(EMBED_COLOR))
|
||||
file = discord.File("../resources/images/interaction/femboy.png", filename="imagen.png")
|
||||
embed.set_image(url="attachment://imagen.gif")
|
||||
await ctx.respond(file=file,embed=embed)
|
||||
|
||||
# ----------------| ESPECÍFICAS |-------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@inter.command(name='run', guild_ids=GUILD_IDS, description="Huye!!!")
|
||||
async def run(self, ctx): # type: ignore
|
||||
embed = discord.Embed(
|
||||
description=f"{ctx.author.mention} se puso a correr", color=discord.Color(EMBED_COLOR))
|
||||
file = discord.File("../resources/images/interaction/run.gif", filename="imagen.gif")
|
||||
embed.set_image(url="attachment://imagen.gif")
|
||||
await ctx.respond(file=file, embed=embed)
|
||||
|
||||
@inter.command(name='fbi', guild_ids=GUILD_IDS, description="Llama al FBI.")
|
||||
async def run(self, ctx, *, miembro: discord.Member):
|
||||
embed = discord.Embed(
|
||||
description=f"{ctx.author.mention} ha llamado al FBI. Corre {miembro.mention}!", color=discord.Color(EMBED_COLOR))
|
||||
file = discord.File("../resources/images/interaction/fbi.gif", filename="imagen.gif")
|
||||
embed.set_image(url="attachment://imagen.gif")
|
||||
await ctx.respond(file=file, embed=embed)
|
||||
|
||||
@inter.command(name='spank', guild_ids=GUILD_IDS, description="Reparte nalgadas como panes.")
|
||||
async def spank(self, ctx, *, alguien: discord.Member):
|
||||
embed = discord.Embed(
|
||||
description=f"{ctx.author.mention} nalgueó a {alguien.mention} >///<", color=discord.Color(EMBED_COLOR))
|
||||
file = discord.File("../resources/images/interaction/spank.gif", filename="imagen.gif")
|
||||
embed.set_image(url="attachment://imagen.gif")
|
||||
await ctx.respond(file=file, embed=embed)
|
||||
|
||||
@inter.command(name='ship', guild_ids=GUILD_IDS, description="Shipea a dos personas (porcentaje de compatibilidad).")
|
||||
async def ship(self, ctx, *, persona1: discord.Member, persona2: discord.Member):
|
||||
embed = discord.Embed(
|
||||
description=f"{persona1.mention} x {persona2.mention}\n ❤️ La compatibilidad es del: **{random.randint(0, 100)}%**", color=discord.Color(EMBED_COLOR))
|
||||
file = discord.File("../resources/images/interaction/ship.gif", filename="imagen.gif")
|
||||
embed.set_image(url="attachment://imagen.gif")
|
||||
await ctx.respond(file=file, embed=embed)
|
||||
|
||||
@inter.command(name='moan', guild_ids=GUILD_IDS, description="Gime como una perra.")
|
||||
async def moan(self, ctx):
|
||||
embed = discord.Embed(
|
||||
description=f"{ctx.author.mention} gimió como una perra.", color=discord.Color(EMBED_COLOR))
|
||||
file = discord.File("../resources/images/interaction/moan.gif", filename="imagen.gif")
|
||||
embed.set_image(url="attachment://imagen.gif")
|
||||
await ctx.respond(file=file, embed=embed)
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(Interaccion(bot))
|
||||
143
src/cogs/math.py
Normal file
@@ -0,0 +1,143 @@
|
||||
import time
|
||||
import discord
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
from discord.ext import commands
|
||||
from discord.commands import SlashCommandGroup
|
||||
from matplotlib.patches import Circle
|
||||
from settings import EMBED_COLOR, GUILD_IDS
|
||||
from utils.bot import esPar, esPrimo
|
||||
|
||||
class Math(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self._last_member = None
|
||||
|
||||
mates = SlashCommandGroup("mates", "Comandos de Matemáticas", guild_ids=GUILD_IDS)
|
||||
|
||||
@mates.command(name='contar', guild_ids=GUILD_IDS, description="Cuenta desde a hasta b.")
|
||||
async def contar(self, ctx, a: int, b: int):
|
||||
await ctx.respond(f"*Contando desde {a} hasta {b}...*", ephemeral=True)
|
||||
i = a
|
||||
time.sleep(1)
|
||||
await ctx.send(a)
|
||||
time.sleep(1)
|
||||
for i in range(a, b):
|
||||
await ctx.send(str(i+1))
|
||||
time.sleep(1)
|
||||
|
||||
@mates.command(name="calc", guild_ids=GUILD_IDS, description="Resuelve una expresión matemática.")
|
||||
async def calc(self, ctx, *, expresion):
|
||||
embed = discord.Embed(color=discord.Color(EMBED_COLOR))
|
||||
embed.add_field(name="**Resultado**",
|
||||
value=f"{expresion} = " + str(eval(expresion)))
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@mates.command(name="par", guild_ids=GUILD_IDS, description="Dice si un número es par o no.")
|
||||
async def par(self, ctx, numero: int):
|
||||
numres = esPar(numero)
|
||||
embed = discord.Embed(color=discord.Color(EMBED_COLOR))
|
||||
embed.add_field(name="**Resultado**", value=numres)
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@mates.command(name="primo", guild_ids=GUILD_IDS, description="Dice si un número es primo o no.")
|
||||
async def primo(self, ctx, numero: int):
|
||||
numres = esPrimo(numero)
|
||||
embed = discord.Embed(color=discord.Color(EMBED_COLOR))
|
||||
embed.add_field(name="**Resultado**", value=numres)
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@mates.command(name='grafseno', guild_ids=GUILD_IDS, description="Grafica una función seno (a, k).")
|
||||
async def grafseno(self, ctx, a: int, k: int):
|
||||
x = np.linspace(0, 2*np.pi, 400)
|
||||
y = a * np.sin(k*x)
|
||||
plt.axhline(0, color="black")
|
||||
plt.plot(x, y, color="#b2122f")
|
||||
plt.savefig("../resources/images/graphics/graf.png")
|
||||
await ctx.respond(file=discord.File("../resources/images/graphics/graf.png"))
|
||||
plt.clf()
|
||||
|
||||
@mates.command(name='grafcoseno', guild_ids=GUILD_IDS, description="Grafica una función coseno (a, k).")
|
||||
async def grafcoseno(self, ctx, a: int, k: int):
|
||||
x = np.linspace(0, 2*np.pi, 400)
|
||||
y = a * np.cos(k*x)
|
||||
plt.axhline(0, color="black")
|
||||
plt.plot(x, y, color="#b2122f")
|
||||
plt.savefig("../resources/images/graphics/graf.png")
|
||||
await ctx.respond(file=discord.File("../resources/images/graphics/graf.png"))
|
||||
plt.clf()
|
||||
|
||||
@mates.command(name='grafrecta', guild_ids=GUILD_IDS, description="Grafica una función lineal (m, n).")
|
||||
async def grafrecta(self, ctx, m: int, n: int):
|
||||
def f(x):
|
||||
return m*x+n
|
||||
x = range(-10000, 10000)
|
||||
y = [f(i) for i in x]
|
||||
plt.axhline(0, color="black")
|
||||
plt.axvline(0, color="black")
|
||||
plt.xlim(-10, 10)
|
||||
plt.ylim(-20, 20)
|
||||
plt.plot(x, y, color="#b2122f")
|
||||
plt.savefig("../resources/images/graphics/graf.png")
|
||||
await ctx.respond(file=discord.File("../resources/images/graphics/graf.png"))
|
||||
plt.clf()
|
||||
|
||||
@mates.command(name='grafparabola', guild_ids=GUILD_IDS, description="Grafica una parábola (a, b, c).")
|
||||
async def grafparabola(self, ctx, a: int, b: int, c: int):
|
||||
def f(x):
|
||||
return a*(x*x)+b*x+c
|
||||
x = np.linspace(-10, 10, 1000)
|
||||
y = [f(i) for i in x]
|
||||
plt.axhline(0, color="black")
|
||||
plt.axvline(0, color="black")
|
||||
plt.xlim(-10, 10)
|
||||
plt.ylim(-20, 20)
|
||||
plt.plot(x, y, color="#b2122f")
|
||||
plt.savefig("../resources/images/graphics/graf.png")
|
||||
await ctx.respond(file=discord.File("../resources/images/graphics/graf.png"))
|
||||
plt.clf()
|
||||
|
||||
@mates.command(name='grafcircunferencia', guild_ids=GUILD_IDS, description="Grafica una circunferencia (r).")
|
||||
async def grafcircunferencia(self, ctx, r: int):
|
||||
fig, ax = plt.subplots()
|
||||
ax.set_aspect('equal')
|
||||
circle1 = Circle((0, 0), r, color='r')
|
||||
ax.add_artist(circle1)
|
||||
plt.xlim(-10, 10)
|
||||
plt.ylim(-10, 10)
|
||||
plt.savefig("../resources/images/graphics/graf.png")
|
||||
await ctx.respond(file=discord.File("../resources/images/graphics/graf.png"))
|
||||
plt.clf()
|
||||
|
||||
@mates.command(name='graflog', guild_ids=GUILD_IDS, description="Grafica una función logarítmica (a, b).")
|
||||
async def graflog(self, ctx, a: int, b: int):
|
||||
def f(x):
|
||||
return a*np.log(x)+b
|
||||
x = np.linspace(-10, 10, 1000)
|
||||
y = [f(i) for i in x]
|
||||
plt.axhline(0, color="black")
|
||||
plt.axvline(0, color="black")
|
||||
plt.xlim(-10, 10)
|
||||
plt.ylim(-20, 20)
|
||||
plt.plot(x, y, color="#b2122f")
|
||||
plt.savefig("../resources/images/graphics/graf.png")
|
||||
await ctx.respond(file=discord.File("../resources/images/graphics/graf.png"))
|
||||
plt.clf()
|
||||
|
||||
@mates.command(name='grafexp', guild_ids=GUILD_IDS, description="Grafica una función exponencial (a, b).")
|
||||
async def grafexp(self, ctx, a: int, b: int):
|
||||
def f(x):
|
||||
return a*np.exp(b*x)
|
||||
x = np.linspace(-10, 10, 1000)
|
||||
y = [f(i) for i in x]
|
||||
plt.axhline(0, color="black")
|
||||
plt.axvline(0, color="black")
|
||||
plt.xlim(-10, 10)
|
||||
plt.ylim(-20, 20)
|
||||
plt.plot(x, y, color="#b2122f")
|
||||
plt.savefig("../resources/images/graphics/graf.png")
|
||||
await ctx.respond(file=discord.File("../resources/images/graphics/graf.png"))
|
||||
plt.clf()
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(Math(bot))
|
||||
146
src/cogs/misc.py
Normal file
@@ -0,0 +1,146 @@
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
from discord.commands import SlashCommandGroup
|
||||
from settings import EMBED_COLOR, BOT_NAME, VERSION, OWNER_ID, DISCORD_LOGO, BOT_LOGO, GUILD_IDS
|
||||
from datetime import datetime
|
||||
from random import randint, choice
|
||||
import hmtai
|
||||
|
||||
class Misc(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self._last_member = None
|
||||
|
||||
misc = SlashCommandGroup(
|
||||
name="misc",
|
||||
description="Comandos varios",
|
||||
guild_ids=GUILD_IDS
|
||||
)
|
||||
|
||||
@misc.command(name="ping", guild_ids=GUILD_IDS, description="Muestra la latencia del bot.")
|
||||
async def ping(self, ctx) -> None:
|
||||
await ctx.respond(f'Pong! Latency is {round(float(self.bot.latency * 1000), 2)}')
|
||||
|
||||
@misc.command(name="info", guild_ids=GUILD_IDS, description="Muestra información sobre el servidor.")
|
||||
async def info(self, ctx) -> None:
|
||||
embed1 = discord.Embed(title=f"{ctx.guild.name}", description="Información del servidor",
|
||||
timestamp=datetime.now(), color=discord.Color(EMBED_COLOR))
|
||||
embed1.add_field(name="Miembros: ", value=f"{ctx.guild.member_count}")
|
||||
embed1.add_field(name="Creador: ", value=f"{ctx.guild.owner}")
|
||||
embed1.add_field(name="Nº comandos", value=f"{len(self.bot.commands)}")
|
||||
mclogo = discord.File("../"+DISCORD_LOGO, filename="image.png")
|
||||
embed1.set_footer(icon_url="attachment://image.png",
|
||||
text=f"pedido por {ctx.author.name}")
|
||||
embed1.set_thumbnail(url="attachment://image.png")
|
||||
|
||||
embed2 = discord.Embed(
|
||||
title=f"Nuestro bot {BOT_NAME}", color=discord.Color(EMBED_COLOR))
|
||||
embed2.add_field(name="Lenguaje", value=f"Python", inline=False)
|
||||
embed2.add_field(name="Tipo", value=f"Multipropósito", inline=False)
|
||||
embed2.add_field(name="Versión", value=str(VERSION), inline=False)
|
||||
pypeav = discord.File("../"+BOT_LOGO, filename="image.png")
|
||||
embed2.set_image(url="attachment://image.png")
|
||||
|
||||
await ctx.respond(file=mclogo, embed=embed1)
|
||||
await ctx.respond(file=pypeav, embed=embed2)
|
||||
|
||||
@misc.command(name='say', guild_ids=GUILD_IDS, description="Manda un mensaje a través del bot.")
|
||||
async def say(self, ctx, *, algo) -> None:
|
||||
await ctx.respond("Mensaje enviado :)", ephemeral=True)
|
||||
await ctx.send(algo)
|
||||
|
||||
@misc.command(name='platano', guild_ids=GUILD_IDS, description="Conoce la medida de tu plátano.")
|
||||
async def platano(self, ctx) -> None:
|
||||
if ctx.author.id == OWNER_ID:
|
||||
banana = 21
|
||||
else:
|
||||
banana = randint(-5, 21)
|
||||
embed = discord.Embed(
|
||||
title=f"El plátano de **{ctx.author}** mide {banana} cm 😳", color=discord.Color(EMBED_COLOR))
|
||||
embed.set_image(
|
||||
url="https://cdn.discordapp.com/attachments/755529601333067940/853072892702490624/banana.png")
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@misc.command(name='dado', guild_ids=GUILD_IDS, description="Tira un dado de 6 caras.")
|
||||
async def dado(self, ctx) -> None:
|
||||
res = randint(1, 6)
|
||||
embed = discord.Embed(title="🎲 Se ha lanzado un dado",
|
||||
color=discord.Color(EMBED_COLOR))
|
||||
embed.add_field(name="Resultado: ", value=str(res))
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@misc.command(name='moneda', guild_ids=GUILD_IDS, description="Tira una moneda al aire.")
|
||||
async def moneda(self, ctx) -> None:
|
||||
coinResults = ("Cara 😀", "Cruz ❌")
|
||||
res = choice(coinResults)
|
||||
embed = discord.Embed(title="🪙 Se ha lanzado la moneda",
|
||||
color=discord.Color(EMBED_COLOR))
|
||||
embed.add_field(name="Resultado: ", value=res)
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@misc.command(name='avatar', guild_ids=GUILD_IDS, description="Renderiza el avatar de alguien.")
|
||||
async def avatar(self, ctx, *, miembro: discord.Member) -> None:
|
||||
embed = discord.Embed(color=discord.Color(EMBED_COLOR))
|
||||
embed.add_field(name='Avatar de:', value=miembro.mention)
|
||||
if miembro.avatar:
|
||||
pfp = miembro.avatar.with_size(1024)
|
||||
embed.set_image(url=pfp)
|
||||
else:
|
||||
embed.add_field(name='No hay avatar', value='Este usuario no tiene un avatar personalizado.')
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@misc.command(name='wallpaper', guild_ids=GUILD_IDS, description="Wallpaper de anime para pc.")
|
||||
async def wallpaper(self, ctx) -> None:
|
||||
embed = discord.Embed(
|
||||
description=f"Aquí tienes tu wallpaper, {ctx.author.mention}", color=discord.Color(EMBED_COLOR))
|
||||
embed.set_image(url=hmtai.get("hmtai", "wallpaper"))
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@misc.command(name='mobilewallpaper', guild_ids=GUILD_IDS, description="Genera un wallpaper para tu móvil.")
|
||||
async def mobileWallpaper(self, ctx) -> None:
|
||||
embed = discord.Embed(
|
||||
description=f"Aquí tienes tu wallpaper {ctx.author.mention}", color=discord.Color(EMBED_COLOR))
|
||||
embed.set_image(url=hmtai.get("hmtai", "mobileWallpaper"))
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@misc.command(name='paredes', guild_ids=GUILD_IDS, description="Están por las paredes.")
|
||||
async def paredes(self, ctx, *, miembro: discord.Member) -> None:
|
||||
embed = discord.Embed(
|
||||
description=f"{miembro.mention} está por las paredes!", color=discord.Color(EMBED_COLOR))
|
||||
file = discord.File("../resources/images/interaction/paredes.gif", filename="imagen.gif")
|
||||
embed.set_image(url="attachment://imagen.gif")
|
||||
await ctx.respond(file=file, embed=embed)
|
||||
|
||||
@misc.command(name='oooh', guild_ids=GUILD_IDS, description="Ooohh.")
|
||||
async def oooh(self, ctx) -> None:
|
||||
embed = discord.Embed(color=discord.Color(EMBED_COLOR))
|
||||
file = discord.File("../resources/images/interaction/oooh.gif", filename="imagen.gif")
|
||||
embed.set_image(url="attachment://imagen.gif")
|
||||
await ctx.respond(file=file, embed=embed)
|
||||
|
||||
@misc.command(name='carey', guild_ids=GUILD_IDS, description="Feliz navidad.")
|
||||
async def carey(self, ctx) -> None:
|
||||
file = discord.File("../resources/images/interaction/dale al play.webm")
|
||||
await ctx.respond(file=file)
|
||||
|
||||
@misc.command(name='beber', guild_ids=GUILD_IDS, description="Bebe alcohol.")
|
||||
async def beber(self, ctx) -> None:
|
||||
# lista de bebidas alcohólicas
|
||||
bebidas = ["cerveza", "vino", "whisky", "ron", "vodka", "tequila", "ginebra", "sidra", "champán", "cava", "sake", "absenta", "brandy", "licor", "vermut", "mezcal", "pacharán", "anís", "aguardiente", "coñac", "cóctel", "cubata", "cóctel", "cubalibre"]
|
||||
bebida = choice(bebidas)
|
||||
embed = discord.Embed(
|
||||
description=f"{ctx.author.mention} ha bebido {bebida}", color=discord.Color(EMBED_COLOR))
|
||||
file = discord.File("../resources/images/interaction/beber.gif", filename="imagen.gif")
|
||||
embed.set_image(url="attachment://imagen.gif")
|
||||
await ctx.respond(file=file, embed=embed)
|
||||
|
||||
@misc.command(name="bombardeen", guild_ids=GUILD_IDS, description="Bombardea a alguien/algo.")
|
||||
async def bombardeen(self, ctx, *, objetivo) -> None:
|
||||
embed = discord.Embed(
|
||||
description=f"Bombardeen {objetivo}", color=discord.Color(EMBED_COLOR))
|
||||
file = discord.File("../resources/images/interaction/bombardeen.gif", filename="imagen.gif")
|
||||
embed.set_image(url="attachment://imagen.gif")
|
||||
await ctx.respond(file=file, embed=embed)
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(Misc(bot))
|
||||
168
src/cogs/music.py
Normal file
@@ -0,0 +1,168 @@
|
||||
import discord
|
||||
import wavelink
|
||||
from discord.ext import commands
|
||||
from discord.commands import SlashCommandGroup
|
||||
import wavelink
|
||||
from settings import (
|
||||
EMBED_COLOR, GUILD_IDS, WAVELINK_URI, WAVELINK_PASSWORD, GUILD_NAME
|
||||
)
|
||||
from utils.logger.pype_logger import PypeLogger
|
||||
|
||||
class Music(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self._last_member = None
|
||||
|
||||
musica = SlashCommandGroup("musica", "Comandos de música", guild_ids=GUILD_IDS)
|
||||
|
||||
async def setup_hook(self) -> None:
|
||||
# Wavelink 2.0 has made connecting Nodes easier... Simply create each Node
|
||||
# and pass it to NodePool.connect with the client/bot.
|
||||
node: wavelink.Node = wavelink.Node(uri=WAVELINK_URI, password=WAVELINK_PASSWORD, secure=False)
|
||||
await wavelink.NodePool.connect(client=self.bot, nodes=[node])
|
||||
PypeLogger.success(f"Se ha conectado a -> {node}")
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_ready(self):
|
||||
await self.setup_hook()
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_wavelink_track_start(self, track: wavelink.TrackEventPayload):
|
||||
await self.bot.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name=track.track.title))
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_wavelink_track_end(self, track: wavelink.TrackEventPayload):
|
||||
await self.bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name=GUILD_NAME))
|
||||
|
||||
@musica.command(name="play", guild_ids=GUILD_IDS, description="Reproduce una canción")
|
||||
async def play(self, ctx: commands.Context, *, cancion: str, sitio: str = "youtube") -> None:
|
||||
if not ctx.voice_client:
|
||||
vc: wavelink.Player = await ctx.author.voice.channel.connect(cls=wavelink.Player)
|
||||
else:
|
||||
vc: wavelink.Player = ctx.voice_client
|
||||
if sitio == "spotify":
|
||||
#decoded = spotify.decode_url(cancion)
|
||||
#if not decoded or decoded['type'] is not spotify.SpotifySearchType.track:
|
||||
# await ctx.send('Sólo se permiten urls de Spotify.')
|
||||
# return
|
||||
#track = await spotify.SpotifyTrack.search(cancion)
|
||||
ctx.respond("Próximamente")
|
||||
elif sitio == "youtube":
|
||||
track = await wavelink.YouTubeTrack.search(cancion, return_first=True)
|
||||
if not vc.is_playing():
|
||||
await vc.play(track)
|
||||
try:
|
||||
await self.bot.user.edit(avatar=open("../resources/images/djpype.png", "rb").read())
|
||||
except:
|
||||
pass
|
||||
embed = discord.Embed(title="▶️ Reproduciendo", description=track.title + " de " + track.author + " en " + sitio, color=EMBED_COLOR)
|
||||
elif vc.is_playing():
|
||||
cola: wavelink.BaseQueue = vc.auto_queue
|
||||
vc.autoplay = True
|
||||
await cola.put_wait(track)
|
||||
embed = discord.Embed(title="🎶 Añadido a la cola", description=track.title + " de " + track.author + " en " + sitio, color=EMBED_COLOR)
|
||||
if cola.is_empty:
|
||||
embed = discord.Embed(title="▶️ Reproduciendo", description="La cola está vacía.", color=EMBED_COLOR)
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@musica.command(name="pause", guild_ids=GUILD_IDS, description="Pausa la canción")
|
||||
async def pausa(self, ctx: commands.Context) -> None:
|
||||
vc: wavelink.Player = ctx.voice_client
|
||||
if vc.is_playing():
|
||||
if vc.is_paused():
|
||||
embed = discord.Embed(title="⏸️ Pausado", description="La canción ya está pausada.", color=EMBED_COLOR)
|
||||
await vc.pause()
|
||||
embed = discord.Embed(title="⏸️ Pausado", description="La canción ha sido pausada.", color=EMBED_COLOR)
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@musica.command(name="resume", guild_ids=GUILD_IDS, description="Reanuda la canción")
|
||||
async def reanudar(self, ctx: commands.Context) -> None:
|
||||
vc: wavelink.Player = ctx.voice_client
|
||||
await vc.resume()
|
||||
embed = discord.Embed(title="▶️ Reproduciendo", description="La canción ha sido reanudada.", color=EMBED_COLOR)
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@musica.command(name="stop", guild_ids=GUILD_IDS, description="Detiene la canción")
|
||||
async def parar(self, ctx: commands.Context) -> None:
|
||||
vc: wavelink.Player = ctx.voice_client
|
||||
await vc.stop()
|
||||
embed = discord.Embed(title="⏹️ Detenido", description="La canción ha sido detenida.", color=EMBED_COLOR)
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@musica.command(name="join", guild_ids=GUILD_IDS, description="Conecta al bot al canal de voz")
|
||||
async def conectar(self, ctx: commands.Context) -> None:
|
||||
if not ctx.voice_client:
|
||||
await ctx.author.voice.channel.connect(cls=wavelink.Player)
|
||||
else:
|
||||
ctx.voice_client
|
||||
embed = discord.Embed(title="🔊 Conectado", description="Me he conectado al canal de voz.", color=EMBED_COLOR)
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@musica.command(name="leave", guild_ids=GUILD_IDS, description="Desconecta al bot del canal de voz")
|
||||
async def desconectar(self, ctx: commands.Context) -> None:
|
||||
vc: wavelink.Player = ctx.voice_client
|
||||
await vc.disconnect()
|
||||
await self.bot.user.edit(avatar=open("../resources/images/pype.png", "rb").read())
|
||||
await self.bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="Concord"))
|
||||
embed = discord.Embed(title="🔊 Desconectado", description="Me he desconectado del canal de voz.", color=EMBED_COLOR)
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@musica.command()
|
||||
async def ahora(self, ctx: commands.Context) -> None:
|
||||
vc: wavelink.Player = ctx.voice_client
|
||||
track: wavelink.Track = vc.current
|
||||
embed = discord.Embed(title="🎶 Canción actual", description=track.title + " de " + track.author, color=EMBED_COLOR)
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@musica.command(name="volume", guild_ids=GUILD_IDS, description="Cambia el volumen del bot")
|
||||
async def volumen(self, ctx: commands.Context, volumen: int) -> None:
|
||||
vc: wavelink.Player = ctx.voice_client
|
||||
if volumen < 100:
|
||||
await vc.set_volume(volumen)
|
||||
embed = discord.Embed(title="🔊 Volumen", description="El volumen ha sido cambiado a " + str(volumen), color=EMBED_COLOR)
|
||||
else:
|
||||
embed = discord.Embed(title="🔊 Volumen", description="El volumen no puede ser mayor a 100.", color=EMBED_COLOR)
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@musica.command(name="loop", guild_ids=GUILD_IDS, description="Repite la canción o la cola")
|
||||
async def bucle(self, ctx: commands.Context, *, bucle = "current") -> None:
|
||||
vc: wavelink.Player = ctx.voice_client
|
||||
if bucle == "current":
|
||||
vc.queue.loop = True
|
||||
embed = discord.Embed(title="🔁 Repetir", description="La canción se repetirá indefinidamente.", color=EMBED_COLOR)
|
||||
elif bucle == "all":
|
||||
vc.queue.loop_all = True
|
||||
embed = discord.Embed(title="🔁 Repetir", description="La cola se repetirá indefinidamente.", color=EMBED_COLOR)
|
||||
elif bucle == "off":
|
||||
vc.queue.loop = False
|
||||
vc.queue.loop_all = False
|
||||
embed = discord.Embed(title="🔁 Repetir", description="La repetición ha sido desactivada.", color=EMBED_COLOR)
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@musica.command(name="seek", guild_ids=GUILD_IDS, description="Avanza la canción x segundos")
|
||||
async def avanzar(self, ctx: commands.Context, segundos: int) -> None:
|
||||
vc: wavelink.Player = ctx.voice_client
|
||||
await vc.seek(segundos*1000)
|
||||
embed = discord.Embed(title="⏩ Avanzar", description="Se han adelantado " + str(segundos) + "s.", color=EMBED_COLOR)
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@musica.command(name="queue", guild_ids=GUILD_IDS, description="Muestra la cola de canciones")
|
||||
async def cola(self, ctx: commands.Context) -> None:
|
||||
vc: wavelink.Player = ctx.voice_client
|
||||
cola = vc.auto_queue
|
||||
embed = discord.Embed(title="🎶 Cola", description="", color=EMBED_COLOR)
|
||||
i = 1
|
||||
for track in cola._queue:
|
||||
embed.add_field(name=f"Canción nº{i}", value=f"{track.title} de {track.author}", inline = False)
|
||||
i+=1
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@musica.command(name="skip", guild_ids=GUILD_IDS, description="Salta a la siguiente canción")
|
||||
async def saltar(self, ctx: commands.Context) -> None:
|
||||
vc: wavelink.Player = ctx.voice_client
|
||||
await vc.play(vc.auto_queue.get())
|
||||
embed = discord.Embed(title="⏭️ Saltar", description=f"Se ha saltado a la siguiente canción", color=EMBED_COLOR)
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(Music(bot))
|
||||
153
src/cogs/nsfw.py
Normal file
@@ -0,0 +1,153 @@
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
from discord.commands import SlashCommandGroup
|
||||
import hmtai
|
||||
from settings import GUILD_IDS
|
||||
|
||||
class InteraccionNSFW(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self._last_member = None
|
||||
|
||||
nsfw = SlashCommandGroup("nsfw", "Comandos NSFW", guild_ids=GUILD_IDS)
|
||||
|
||||
@nsfw.command(name='creampie', guild_ids=GUILD_IDS, description="Lechita.")
|
||||
async def creampie(self, ctx, *, miembro: discord.Member = None):
|
||||
if ctx.channel.is_nsfw():
|
||||
if miembro:
|
||||
embed = discord.Embed(description=f"{ctx.author.mention} se vino en {miembro.mention} 😳", color=discord.Color.from_rgb(177,18,46))
|
||||
else:
|
||||
embed = discord.Embed(description=f"{ctx.author.mention} se vino 😳", color=discord.Color.from_rgb(177,18,46))
|
||||
embed.set_image(url=hmtai.get("hmtai","creampie"))
|
||||
await ctx.respond(embed=embed)
|
||||
else:
|
||||
await ctx.respond("*Debes usar el comando en un canal NSFW...*", ephemeral=True)
|
||||
|
||||
@nsfw.command(name='hentai', guild_ids=GUILD_IDS, description="Go to horny jail.")
|
||||
async def hentai(self, ctx):
|
||||
if ctx.channel.is_nsfw():
|
||||
embed = discord.Embed(description="Disfruta 😳", color=discord.Color.from_rgb(177,18,46))
|
||||
embed.set_image(url=hmtai.get("hmtai","classic"))
|
||||
await ctx.respond(embed=embed)
|
||||
else:
|
||||
await ctx.respond("*Debes usar el comando en un canal NSFW...*", ephemeral=True)
|
||||
|
||||
@nsfw.command(name='anal', guild_ids=GUILD_IDS, description="Es la hora de dar por culo.")
|
||||
async def anal(self, ctx, *, miembro: discord.Member):
|
||||
if ctx.channel.is_nsfw():
|
||||
embed = discord.Embed(description=f"{ctx.author.mention}: * le da por culo *\n {miembro.mention}: Man dao por culo Dios mío! Hola.", color=discord.Color.from_rgb(177,18,46))
|
||||
embed.set_image(url=hmtai.get("hmtai","anal"))
|
||||
await ctx.respond(embed=embed)
|
||||
else:
|
||||
await ctx.respond("*Debes usar el comando en un canal NSFW...*", ephemeral = True)
|
||||
|
||||
@nsfw.command(name='ass', guild_ids=GUILD_IDS, description="Culito, culito!")
|
||||
async def ass(self, ctx):
|
||||
if ctx.channel.is_nsfw():
|
||||
embed = discord.Embed(description=f"{ctx.author.mention} toma culo!", color=discord.Color.from_rgb(177,18,46))
|
||||
embed.set_image(url=hmtai.get("hmtai","ass"))
|
||||
await ctx.respond(embed=embed)
|
||||
else:
|
||||
await ctx.respond("*Debes usar el comando en un canal NSFW...*", ephemeral = True)
|
||||
|
||||
@nsfw.command(name='bdsm', guild_ids=GUILD_IDS, description="Atar?")
|
||||
async def bdsm(self, ctx,*,miembro: discord.Member = None):
|
||||
if ctx.channel.is_nsfw():
|
||||
if miembro:
|
||||
embed = discord.Embed(description=f"{ctx.author.mention} le practicó el BDSM a {miembro.mention} 😳", color=discord.Color.from_rgb(177,18,46))
|
||||
else:
|
||||
embed = discord.Embed(description=f"A {ctx.author.mention} le gusta el BDSM!", color=discord.Color.from_rgb(177,18,46))
|
||||
embed.set_image(url=hmtai.get("hmtai","bdsm"))
|
||||
await ctx.respond(embed=embed)
|
||||
else:
|
||||
await ctx.respond("*Debes usar el comando en un canal NSFW...*", ephemeral=True)
|
||||
|
||||
@nsfw.command(name='doujin', guild_ids=GUILD_IDS, description="Página random de un doujinshi.")
|
||||
async def doujin(self, ctx):
|
||||
if ctx.channel.is_nsfw():
|
||||
embed = discord.Embed(description=f"Aquí tienes tu página random de un doujin, {ctx.author.mention}.", color=discord.Color.from_rgb(177,18,46))
|
||||
embed.set_image(url=hmtai.get("hmtai","manga"))
|
||||
await ctx.respond(embed=embed)
|
||||
else:
|
||||
await ctx.respond("*Debes usar el comando en un canal NSFW...*", ephemeral=True)
|
||||
|
||||
@nsfw.command(name='fap', guild_ids=GUILD_IDS, description="Fap fap fap fap.")
|
||||
async def fap(self, ctx, *, miembro: discord.Member = None):
|
||||
if ctx.channel.is_nsfw():
|
||||
if miembro:
|
||||
embed = discord.Embed(description=f"{ctx.author.mention} hizo sentir rico a {miembro.mention} 😳", color=discord.Color.from_rgb(177,18,46))
|
||||
else:
|
||||
embed = discord.Embed(description=f"{ctx.author.mention} se tocó 😳", color=discord.Color.from_rgb(177,18,46))
|
||||
embed.set_image(url=hmtai.get("hmtai","handjob"))
|
||||
await ctx.respond(embed=embed)
|
||||
else:
|
||||
await ctx.respond("*Debes usar el comando en un canal NSFW...*", ephemeral=True)
|
||||
|
||||
@nsfw.command(name='ero', guild_ids=GUILD_IDS, description="Fucking pervert.")
|
||||
async def ero(self, ctx):
|
||||
if ctx.channel.is_nsfw():
|
||||
embed = discord.Embed(description=f"Aquí tienes tu contenido ero, {ctx.author.mention}.", color=discord.Color.from_rgb(177,18,46))
|
||||
embed.set_image(url=hmtai.get("hmtai","ero"))
|
||||
await ctx.respond(embed=embed)
|
||||
else:
|
||||
await ctx.respond("*Debes usar el comando en un canal NSFW...*", ephemeral=True)
|
||||
|
||||
@nsfw.command(name='yuri', guild_ids=GUILD_IDS, description="Imagen yuri 🏳️🌈.")
|
||||
async def yuri(self, ctx):
|
||||
if ctx.channel.is_nsfw():
|
||||
embed = discord.Embed(description=f"Aquí tienes tu contenido yuri, {ctx.author.mention}.", color=discord.Color.from_rgb(177,18,46))
|
||||
embed.set_image(url=hmtai.get("hmtai","yuri"))
|
||||
await ctx.respond(embed=embed)
|
||||
else:
|
||||
await ctx.respond("*Debes usar el comando en un canal NSFW...*", ephemeral=True)
|
||||
|
||||
@nsfw.command(name='blowjob', guild_ids=GUILD_IDS, description="* clk clk clk *")
|
||||
async def blowjob(self, ctx, *, miembro: discord.Member = None):
|
||||
if ctx.channel.is_nsfw():
|
||||
if miembro:
|
||||
embed = discord.Embed(description=f"{ctx.author.mention} * clk clk clk * {miembro.mention} 😳", color=discord.Color.from_rgb(177,18,46))
|
||||
else:
|
||||
embed = discord.Embed(description=f"{ctx.author.mention} realizó la AutoM", color=discord.Color.from_rgb(177,18,46))
|
||||
embed.set_image(url=hmtai.get("hmtai","blowjob"))
|
||||
await ctx.respond(embed=embed)
|
||||
else:
|
||||
await ctx.respond("*Debes usar el comando en un canal NSFW...*", ephemeral=True)
|
||||
|
||||
@nsfw.command(name='boobs', guild_ids=GUILD_IDS, description="tetas tetitas tetazas tetotas tetarracas.")
|
||||
async def boobs(self, ctx):
|
||||
if ctx.channel.is_nsfw():
|
||||
embed = discord.Embed(description=f"Aquí tienes tus tetas tetarracas, {ctx.author.mention}.", color=discord.Color.from_rgb(177,18,46))
|
||||
embed.set_image(url=hmtai.get("hmtai","boobs"))
|
||||
await ctx.respond(embed=embed)
|
||||
else:
|
||||
await ctx.respond("*Debes usar el comando en un canal NSFW...*", ephemeral=True)
|
||||
|
||||
@nsfw.command(name='pussy', guild_ids=GUILD_IDS, description="Es temporada de recogida de higos.")
|
||||
async def pussy(self, ctx):
|
||||
if ctx.channel.is_nsfw():
|
||||
embed = discord.Embed(description=f"{ctx.author.mention} recogió un higo.", color=discord.Color.from_rgb(177,18,46))
|
||||
embed.set_image(url=hmtai.get("hmtai","pussy"))
|
||||
await ctx.respond(embed=embed)
|
||||
else:
|
||||
await ctx.respond("*Debes usar el comando en un canal NSFW...*", ephemeral=True)
|
||||
|
||||
@nsfw.command(name='boobjob', guild_ids=GUILD_IDS, description="Tetas tetarracas + * clk clk clk *")
|
||||
async def boobjob(self, ctx,*,miembro: discord.Member):
|
||||
if ctx.channel.is_nsfw():
|
||||
embed = discord.Embed(description=f"{ctx.author.mention} le hizo una boobjob a {miembro.mention}", color=discord.Color.from_rgb(177,18,46))
|
||||
embed.set_image(url=hmtai.get("hmtai","boobjob"))
|
||||
await ctx.respond(embed=embed)
|
||||
else:
|
||||
await ctx.respond("*Debes usar el comando en un canal NSFW...*", ephemeral=True)
|
||||
|
||||
@nsfw.command(name='gangbang', guild_ids=GUILD_IDS, description="Muchas tuneladoras para un sólo túnel.")
|
||||
async def gangbang(self, ctx, *, abusador_1: discord.Member, abusador_2: discord.Member, abusador_3: discord.Member, victima: discord.Member):
|
||||
if ctx.channel.is_nsfw():
|
||||
embed = discord.Embed(description=f"{ctx.author.mention} & {abusador_1.mention},{abusador_2.mention},{abusador_3.mention} taladraron a {victima.mention} 😳", color=discord.Color.from_rgb(177,18,46))
|
||||
embed.set_image(url=hmtai.get("hmtai","gangbang"))
|
||||
await ctx.respond(embed=embed)
|
||||
else:
|
||||
await ctx.respond("*Debes usar el comando en un canal NSFW...*", ephemeral=True)
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(InteraccionNSFW(bot))
|
||||
57
src/cogs/verification.py
Normal file
@@ -0,0 +1,57 @@
|
||||
from discord.ext import commands
|
||||
from discord.commands import SlashCommandGroup
|
||||
from settings import (
|
||||
GUILD_IDS, VERIFICATION_CHANNEL_ID, VERIFIED_ROLE_ID, UNVERIFIED_ROLE_ID, SUPPORT_ROLE_ID
|
||||
)
|
||||
import asyncio
|
||||
|
||||
class Verification(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self._last_member = None
|
||||
|
||||
verification = SlashCommandGroup("verification", "Verify through the bot", guild_ids=GUILD_IDS)
|
||||
|
||||
@verification.command(name="verify", guild_ids=GUILD_IDS, description="Verify yourself in the server using a command.")
|
||||
async def verificar(self, ctx):
|
||||
if ctx.channel.id == VERIFICATION_CHANNEL_ID:
|
||||
verified = ctx.guild.get_role(VERIFIED_ROLE_ID)
|
||||
unverified = ctx.guild.get_role(UNVERIFIED_ROLE_ID)
|
||||
support_role = ctx.guild.get_role(SUPPORT_ROLE_ID)
|
||||
|
||||
if verified not in ctx.author.roles:
|
||||
await ctx.author.add_roles(unverified)
|
||||
await ctx.send(f"{ctx.author.mention}, please specify your origin (CurseForge/SpigotMC) or enter the secret code to get verified.")
|
||||
|
||||
try:
|
||||
# Esperar la respuesta del usuario en el mismo canal
|
||||
response = await self.bot.wait_for(
|
||||
"message",
|
||||
check=lambda message: message.author == ctx.author and message.channel == ctx.channel,
|
||||
timeout=120 # Puedes ajustar el tiempo límite según tus necesidades
|
||||
)
|
||||
|
||||
# Verificar la respuesta del usuario
|
||||
if "CurseForge" in response.content or "SpigotMC" in response.content:
|
||||
await ctx.author.add_roles(support_role)
|
||||
await ctx.author.remove_roles(unverified)
|
||||
await ctx.send(f"{ctx.author.mention} has been verified from CurseForge or SpigotMC!")
|
||||
await ctx.channel.purge(limit=100)
|
||||
elif "cHV0b3RvbnRvWEQ=" in response.content:
|
||||
await ctx.author.add_roles(verified)
|
||||
await ctx.author.remove_roles(unverified)
|
||||
await ctx.send(f"{ctx.author.mention} has been verified using the secret code!")
|
||||
await ctx.channel.purge(limit=100)
|
||||
else:
|
||||
await ctx.respond("Invalid response. Please specify CurseForge/SpigotMC or the secret code.", ephemeral=True)
|
||||
|
||||
except asyncio.TimeoutError:
|
||||
await ctx.respond("Verification process timed out. Please run the command again.", ephemeral=True)
|
||||
|
||||
else:
|
||||
await ctx.respond("You are already verified.", ephemeral=True)
|
||||
else:
|
||||
await ctx.respond(f"You can only verify in <#{VERIFICATION_CHANNEL_ID}>.", ephemeral=True)
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(Verification(bot))
|
||||
134
src/settings.py
Normal file
@@ -0,0 +1,134 @@
|
||||
##### ####### # # ####### ### ##### # # ###### # ##### ### ####### # #
|
||||
# # # # ## # # # # # # # # # # # # # # # # ## #
|
||||
# # # # # # # # # # # # # # # # # # # # # #
|
||||
# # # # # # ##### # # #### # # ###### # # # # # # # # #
|
||||
# # # # # # # # # # # # # # ####### # # # # # # #
|
||||
# # # # # ## # # # # # # # # # # # # # # # # ##
|
||||
##### ####### # # # ### ##### ##### # # # # ##### ### ####### # #
|
||||
|
||||
# Configuración de parámetros de Discord
|
||||
DISCORD_LOGO = "resources/images/logo.png" # png/jpg
|
||||
DISCORD_INVITE = "https://discord.gg/wSx82bUrFT" # https://discord.gg/TU_INVITACIÓN
|
||||
ADMIN_CHANNEL_ID = 1212498847138447450 # canal para enviar mensajes del bot para admins
|
||||
ADMIN_ROLE_ID = 1093755241494749274 # id del rol de admin obtenido con dev mode
|
||||
ANNOUNCES_CHANNEL_ID = 1242621232281813082 # Canal para enviar anuncios, normalmente el propio canal de anuncios de una comunidad de Discord.
|
||||
WELCOME_CHANNEL_ID = 1212311179846746124 # canal de bienvenidas
|
||||
VERIFICATION_CHANNEL_ID = 0000000000000000000 # canal de verificación
|
||||
VERIFIED_ROLE_ID = 0000000000000000000 # rol verificado
|
||||
UNVERIFIED_ROLE_ID = 0000000000000000000 # rol no verificado
|
||||
COUNTER_CHANNEL_ID = 1244730885836767315 # canal de contador
|
||||
GUILD_IDS = [925562720890277948] # id del servidor obtenido con dev mode ⚠️ DE MOMENTO SOLO SOPORTA UN SERVIDOR A LA VEZ ⚠️
|
||||
SUPPORT_ROLE_ID = 0000000000000000000
|
||||
|
||||
# Configuración de parámetros del bot
|
||||
GUILD_NAME = "MIARMAPLACE" # nombre del servidor
|
||||
BOT_LOGO ="resources/images/pype.png" # png/jpg
|
||||
BOT_NAME = "Pype" # nombre a elegir
|
||||
BOT_TOKEN = "MTAyMDg5MzE2MDY0NzQzMDIyNg.GONoVo.ar4hT-d6JPG6Cpq9jJnafVkb3Z9EFsZY9ZVFVY" # token obtenido en la página de Discord Developers
|
||||
VERSION = "1.0 Rewritten" # versión del bot
|
||||
WAVELINK_URI = 'ether.lunarnodes.xyz:6969' # ip del servidor de Lavalink
|
||||
WAVELINK_PASSWORD = "lunarnodes.xyz" # contraseña del servidor de Lavalink
|
||||
SPOTIFY_CLIENT_ID = '' # id de la app de Spotify
|
||||
SPOTIFY_CLIENT_SECRET = '' # secret de la app de Spotify
|
||||
EMBED_COLOR = 0x2B2D31
|
||||
TIMEZONE = "Europe/Madrid" # zona horaria
|
||||
|
||||
# Configuración de parámetros del owner
|
||||
OWNER_NAME = "Gallardo7761" # nombre sin tag (#XXXX)
|
||||
OWNER_ID = 318818322642763780 # id del owner obtenido con el dev mode
|
||||
|
||||
# Cofiguración de parámetros del comando /help
|
||||
INDICE = "ㅤ\n**★) ** 🪶 Varios\n\n**★) ** 👥 Interacción\n\n**★) ** 🧮 Matemáticas\n\n**★) ** 🎶 Música\n\n**★) ** 💻 Asciiart\n\n**★) ** ✅ Verificacion\n\n**★) ** 🆘 Help\n\n*En las siguientes páginas*\n*hay ayuda más detallada.*"
|
||||
VARIOS = """
|
||||
**/misc ping** - Ping de Pype.
|
||||
**/misc info** - Info del discord.
|
||||
**/misc say** - Pype dice algo.
|
||||
**/misc platano** - Banana!
|
||||
**/misc dado** - Tira un dado de 6 caras.
|
||||
**/misc moneda** - Tira una moneda al aire.
|
||||
**/misc avatar** - Renderiza el avatar de un miembro del servidor.
|
||||
**/misc wallpaper** - Wallpaper de anime (PC).
|
||||
**/misc mobilewallpaper** - Wallpaper de anime (móvil).
|
||||
**/misc paredes** - Están por las paredes.
|
||||
**/misc oooh** - Ooooooooh! .- Exclamaron Mordecai y Rigby.
|
||||
**/misc carey** - Navidad (?)
|
||||
**/misc beber** - Bebe algo.
|
||||
**/misc bombardeen** - Bombardeen algo.
|
||||
"""
|
||||
INTERACCION = """
|
||||
**/inter wave** - Di hola.
|
||||
**/inter dance** - Saca los pasos prohibidos.
|
||||
**/inter nice** - Noice.
|
||||
**/inter nosebleed** - Ecsitante.
|
||||
**/inter punch** - Cruzado o uppercut?
|
||||
**/inter feed** - Alimenta a alguien.
|
||||
**/inter tickle** - Hazle la tortura de las cosquillas a alguien.
|
||||
**/inter bite** - Muerde~ a alguien.
|
||||
**/inter hug** - Abraza a alguien.
|
||||
**/inter kill** - Mata a alguien D:
|
||||
**/inter kiss** - Besa a alguien UwU
|
||||
**/inter pat** - Dale palmaditas a alguien.
|
||||
**/inter slap** - A dar de hostias a alguien.
|
||||
**/inter sleep** - A mimir.
|
||||
**/inter cry** - Tas bien? :(
|
||||
**/inter cuddle** - Acurrúcate con alguien u.u
|
||||
**/inter lick** - Lame a alguien?
|
||||
"""
|
||||
INTERACCION_2 = """
|
||||
**/inter threaten** - Amenaza a alguien >:)
|
||||
**/inter run** - Corre Forrest, corre!
|
||||
**/inter fbi** - FBI OPEN UP!
|
||||
**/inter spank** - Dale nalgadas a alguien.
|
||||
**/inter ship** - Haz un ship entre dos personas.
|
||||
**/inter moan** - Aaaaaaah~!
|
||||
**/femboy** - Femboiza a alguien.
|
||||
"""
|
||||
NSFW = """
|
||||
**/nsfw creampie** Lechita.
|
||||
**/nsfw hentai** Go to horny jail.
|
||||
**/nsfw anal** Es la hora de dar por culo.
|
||||
**/nsfw ass** Culito, culito!
|
||||
**/nsfw bdsm** Atar?
|
||||
**/nsfw doujin** Página random de un doujinshi.
|
||||
**/nsfw fap** Fap fap fap fap.
|
||||
**/nsfw ero** Fucking pervert.
|
||||
**/nsfw yuri** Imagen yuri 🏳️🌈.
|
||||
**/nsfw blowjob** * clk clk clk *
|
||||
**/nsfw boobs** Tetas tetitas tetazas tetotas tetarracas.
|
||||
**/nsfw pussy** Es temporada de recogida de higos.
|
||||
**/nsfw boobjob** Tetas tetarracas + * clk clk clk *
|
||||
**/nsfw gangbang** Muchas tuneladoras para un sólo túnel.
|
||||
"""
|
||||
MATEMATICAS = """
|
||||
**/mates contar** - Cuenta desde un número *a* hasta un número *b*.
|
||||
**/mates calc** - Calcula expresiones matemáticas varias.
|
||||
**/mates par** - Comprueba si un número es par o no.
|
||||
**/mates primo** - Comprueba si un número es primo o no.
|
||||
**/mates grafseno** - Grafica una función seno.
|
||||
**/mates grafcoseno** - Grafica una función coseno.
|
||||
**/mates grafrecta** - Grafica una función lineal.
|
||||
**/mates grafparabola** - Grafica una función cuadrática.
|
||||
**/mates grafcircunferencia** - Grafica una circunferencia.
|
||||
**/mates graflog** - Grafica una función logarítmica.
|
||||
**/mates grafexp** - Grafica una función exponencial.
|
||||
"""
|
||||
MUSICA = """
|
||||
**/musica play** - Reproduce una canción.
|
||||
**/musica pause** - Pausa la reproducción.
|
||||
**/musica resume** - Reanuda la reproducción.
|
||||
**/musica skip** - Salta a la siguiente canción.
|
||||
**/musica seek** - Avanza hacia delante o atrás en la canción.
|
||||
**/musica join** - Conecta al bot al canal de voz.
|
||||
**/musica leave** - Desconecta al bot al canal de voz.
|
||||
**/musica volume** - Establece el volumen del bot.
|
||||
**/musica loop** - Activa/Desactiva el bucle.
|
||||
**/musica queue** - Mira la cola.
|
||||
**/musica now** - Muestra lo que se está reproduciendo ahora mismo.
|
||||
**/musica stop** - Para la canción.
|
||||
"""
|
||||
VERIFICACION = """
|
||||
**/verification verify** - Verifica tu cuenta.
|
||||
"""
|
||||
HELP = """
|
||||
**/help all** - Muestra este mensaje.
|
||||
"""
|
||||
34
src/utils/bot.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from random import choice, randint
|
||||
import csv
|
||||
|
||||
def bot_status_randomizer(fichero) -> str:
|
||||
listStatus = []
|
||||
with open(fichero, encoding="utf-8") as f:
|
||||
lector = csv.reader(f)
|
||||
next(lector)
|
||||
for l in lector:
|
||||
status = str(l[0])
|
||||
listStatus.append(status)
|
||||
return choice(listStatus)
|
||||
|
||||
def get_random_color() -> int:
|
||||
return randint(0, 0xFFFFFF)
|
||||
|
||||
def esPar(numero: int) -> str:
|
||||
if numero % 2 == 0:
|
||||
res = "Es par"
|
||||
else:
|
||||
res = "Es impar"
|
||||
return res
|
||||
|
||||
def esPrimo(numero: int) -> str:
|
||||
if numero > 1:
|
||||
for i in range(2, numero):
|
||||
if (numero % i) == 0:
|
||||
res = "No es primo"
|
||||
break
|
||||
else:
|
||||
res = "Es primo"
|
||||
else:
|
||||
res = "No es primo"
|
||||
return res
|
||||
42
src/utils/embeds.py
Normal file
@@ -0,0 +1,42 @@
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
from settings import EMBED_COLOR, TIMEZONE
|
||||
from datetime import datetime
|
||||
import pytz
|
||||
|
||||
def crear_embed(ctx: commands.Context,
|
||||
title: str,
|
||||
description: str,
|
||||
fields: str = None,
|
||||
footer_text: str = None,
|
||||
timestamp: bool = False,
|
||||
author_name: str = None,
|
||||
image_url: str = None,
|
||||
thumbnail_url: str = None,
|
||||
color: int = None):
|
||||
def bool_parser(string):
|
||||
if string.lower() == "true":
|
||||
return True
|
||||
elif string.lower() == "false":
|
||||
return False
|
||||
else:
|
||||
raise commands.BadArgument("El valor debe ser True o False")
|
||||
embed = discord.Embed(title=title, description=description, color=EMBED_COLOR)
|
||||
if fields:
|
||||
fields_list = fields.split(";;")
|
||||
for field in fields_list:
|
||||
name, value, inline = field.split(",,")
|
||||
embed.add_field(name=name, value=value, inline=bool_parser(inline))
|
||||
if footer_text:
|
||||
embed.set_footer(text=footer_text)
|
||||
if image_url:
|
||||
embed.set_image(url=image_url)
|
||||
if thumbnail_url:
|
||||
embed.set_thumbnail(url=thumbnail_url)
|
||||
if author_name:
|
||||
embed.set_author(name=author_name, icon_url=ctx.author.avatar.url)
|
||||
if timestamp:
|
||||
embed.timestamp = datetime.now(pytz.timezone(TIMEZONE))
|
||||
if color:
|
||||
embed.color = color
|
||||
return embed
|
||||
17
src/utils/files.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import json
|
||||
|
||||
def read(file: str) -> str:
|
||||
with open(file, "r") as f:
|
||||
return f.read()
|
||||
|
||||
def read_json(file: str) -> dict:
|
||||
with open(file, "r") as f:
|
||||
return json.load(f)
|
||||
|
||||
def write(file: str, content: str) -> None:
|
||||
with open(file, "w") as f:
|
||||
f.write(content)
|
||||
|
||||
def write_json(file: str, content: dict) -> None:
|
||||
with open(file, "w") as f:
|
||||
json.dump(content, f, indent=4, sort_keys=True, separators=(',', ': '), ensure_ascii=False)
|
||||
13
src/utils/logger/colors.py
Normal file
@@ -0,0 +1,13 @@
|
||||
class Colors:
|
||||
RED = "\033[91m"
|
||||
GREEN = "\033[92m"
|
||||
YELLOW = "\033[93m"
|
||||
BLUE = "\033[94m"
|
||||
MAGENTA = "\033[95m"
|
||||
CYAN = "\033[96m"
|
||||
WHITE = "\033[97m"
|
||||
RESET = "\033[0m"
|
||||
BOLD = "\033[1m"
|
||||
UNDERLINE = "\033[4m"
|
||||
LIME = "\033[32m"
|
||||
GRAY = "\033[90m"
|
||||
43
src/utils/logger/pype_logger.py
Normal file
@@ -0,0 +1,43 @@
|
||||
from .colors import Colors
|
||||
from datetime import datetime
|
||||
import pytz
|
||||
import traceback
|
||||
|
||||
class PypeLogger:
|
||||
@staticmethod
|
||||
def info(message):
|
||||
now = datetime.now(tz=pytz.timezone("Europe/Madrid")).strftime("%H:%M:%S")
|
||||
print(f"{Colors.GRAY}[{now}] {Colors.GREEN}[INFO] {message}{Colors.RESET}")
|
||||
|
||||
@staticmethod
|
||||
def error(message, exception=None):
|
||||
now = datetime.now(tz=pytz.timezone("Europe/Madrid")).strftime("%H:%M:%S")
|
||||
main_error = f"{Colors.GRAY}[{now}] {Colors.RED}[ERROR] {message}{Colors.RESET}"
|
||||
error_messages = [main_error]
|
||||
if exception:
|
||||
exception_message = f"\n{Colors.GRAY}[{now}] {Colors.RED}[ERROR] - Exception: {exception}"
|
||||
traceback_message = f"\n{Colors.GRAY}[{now}] {Colors.RED}[ERROR] - Traceback: {traceback.format_exc()}"
|
||||
error_messages.append(exception_message)
|
||||
error_messages.append(traceback_message)
|
||||
for error_message in error_messages:
|
||||
print(error_message)
|
||||
|
||||
@staticmethod
|
||||
def debug(message):
|
||||
now = datetime.now(tz=pytz.timezone("Europe/Madrid")).strftime("%H:%M:%S")
|
||||
print(f"{Colors.GRAY}[{now}] {Colors.BLUE}[DEBUG] {message}{Colors.RESET}")
|
||||
|
||||
@staticmethod
|
||||
def warning(message):
|
||||
now = datetime.now(tz=pytz.timezone("Europe/Madrid")).strftime("%H:%M:%S")
|
||||
print(f"{Colors.GRAY}[{now}] {Colors.YELLOW}[WARNING] {message}{Colors.RESET}")
|
||||
|
||||
@staticmethod
|
||||
def success(message):
|
||||
now = datetime.now(tz=pytz.timezone("Europe/Madrid")).strftime("%H:%M:%S")
|
||||
print(f"{Colors.GRAY}[{now}] {Colors.LIME}[SUCCESS] {message}{Colors.RESET}")
|
||||
|
||||
@staticmethod
|
||||
def command(message):
|
||||
now = datetime.now(tz=pytz.timezone("Europe/Madrid")).strftime("%H:%M:%S")
|
||||
print(f"{Colors.GRAY}[{now}] {Colors.MAGENTA}[COMMAND] {message}{Colors.RESET}")
|
||||
7
src/utils/reactions.py
Normal file
@@ -0,0 +1,7 @@
|
||||
import discord
|
||||
|
||||
async def añadir_reacciones(message: discord.Message, reactions: str, n: int) -> None:
|
||||
reactions_list = reactions.split(";")
|
||||
for i in range(n):
|
||||
await message.add_reaction(reactions_list[i])
|
||||
i+=1
|
||||