Update configuration and README for improved setup and security; disable default API and emoji sync, and enhance Discord permission checks in API routes.
This commit is contained in:
@@ -23,6 +23,7 @@ from discord.ui import LayoutView, TextDisplay, Separator, Container
|
||||
from utils.Tools import *
|
||||
from utils.cv2 import CV2, build_container
|
||||
from utils.config import OWNER_IDS
|
||||
from utils.safe_parse import parse_role_id_list, dump_role_id_list
|
||||
|
||||
|
||||
|
||||
@@ -232,7 +233,7 @@ class AutoRole(commands.Cog):
|
||||
data = await cursor.fetchone()
|
||||
|
||||
if data:
|
||||
humans = eval(data[0])
|
||||
humans = parse_role_id_list(data[0])
|
||||
if role.id in humans:
|
||||
view = CV2(f"{ICONS_WARNING} Access Denied", f"{role.mention} is already in human autoroles.")
|
||||
elif len(humans) >= 10:
|
||||
@@ -240,13 +241,13 @@ class AutoRole(commands.Cog):
|
||||
else:
|
||||
humans.append(role.id)
|
||||
async with aiosqlite.connect(DATABASE_PATH) as db:
|
||||
await db.execute("UPDATE autorole SET humans = ? WHERE guild_id = ?", (str(humans), ctx.guild.id))
|
||||
await db.execute("UPDATE autorole SET humans = ? WHERE guild_id = ?", (dump_role_id_list(humans), ctx.guild.id))
|
||||
await db.commit()
|
||||
view = CV2(f"{TICK} Success", f"{role.mention} has been added to human autoroles.")
|
||||
else:
|
||||
humans = [role.id]
|
||||
async with aiosqlite.connect(DATABASE_PATH) as db:
|
||||
await db.execute("INSERT INTO autorole (guild_id, humans, bots) VALUES (?, ?, ?)", (ctx.guild.id, str(humans), '[]'))
|
||||
await db.execute("INSERT INTO autorole (guild_id, humans, bots) VALUES (?, ?, ?)", (ctx.guild.id, dump_role_id_list(humans), '[]'))
|
||||
await db.commit()
|
||||
view = CV2(f"{TICK} Success", f"{role.mention} has been added to human autoroles.")
|
||||
|
||||
@@ -265,13 +266,13 @@ class AutoRole(commands.Cog):
|
||||
data = await cursor.fetchone()
|
||||
|
||||
if data:
|
||||
humans = eval(data[0])
|
||||
humans = parse_role_id_list(data[0])
|
||||
if role.id not in humans:
|
||||
view = CV2(f"{CROSS} Error", f"{role.mention} is not in human autoroles.")
|
||||
else:
|
||||
humans.remove(role.id)
|
||||
async with aiosqlite.connect(DATABASE_PATH) as db:
|
||||
await db.execute("UPDATE autorole SET humans = ? WHERE guild_id = ?", (str(humans), ctx.guild.id))
|
||||
await db.execute("UPDATE autorole SET humans = ? WHERE guild_id = ?", (dump_role_id_list(humans), ctx.guild.id))
|
||||
await db.commit()
|
||||
view = CV2(f"{TICK} Success", f"{role.mention} has been removed from human autoroles.")
|
||||
else:
|
||||
@@ -303,7 +304,7 @@ class AutoRole(commands.Cog):
|
||||
data = await cursor.fetchone()
|
||||
|
||||
if data:
|
||||
bots = eval(data[0])
|
||||
bots = parse_role_id_list(data[0])
|
||||
if role.id in bots:
|
||||
view = CV2(f"{ICONS_WARNING} Access Denied", f"{role.mention} is already in bot autoroles.")
|
||||
elif len(bots) >= 10:
|
||||
@@ -311,13 +312,13 @@ class AutoRole(commands.Cog):
|
||||
else:
|
||||
bots.append(role.id)
|
||||
async with aiosqlite.connect(DATABASE_PATH) as db:
|
||||
await db.execute("UPDATE autorole SET bots = ? WHERE guild_id = ?", (str(bots), ctx.guild.id))
|
||||
await db.execute("UPDATE autorole SET bots = ? WHERE guild_id = ?", (dump_role_id_list(bots), ctx.guild.id))
|
||||
await db.commit()
|
||||
view = CV2(f"{TICK} Success", f"{role.mention} has been added to bot autoroles.")
|
||||
else:
|
||||
bots = [role.id]
|
||||
async with aiosqlite.connect(DATABASE_PATH) as db:
|
||||
await db.execute("INSERT INTO autorole (guild_id, humans, bots) VALUES (?, ?, ?)", (ctx.guild.id, '[]', str(bots)))
|
||||
await db.execute("INSERT INTO autorole (guild_id, humans, bots) VALUES (?, ?, ?)", (ctx.guild.id, '[]', dump_role_id_list(bots)))
|
||||
await db.commit()
|
||||
view = CV2(f"{TICK} Success", f"{role.mention} has been added to bot autoroles.")
|
||||
|
||||
@@ -336,13 +337,13 @@ class AutoRole(commands.Cog):
|
||||
data = await cursor.fetchone()
|
||||
|
||||
if data:
|
||||
bots = eval(data[0])
|
||||
bots = parse_role_id_list(data[0])
|
||||
if role.id not in bots:
|
||||
view = CV2(f"{CROSS} Error", f"{role.mention} is not in bot autoroles.")
|
||||
else:
|
||||
bots.remove(role.id)
|
||||
async with aiosqlite.connect(DATABASE_PATH) as db:
|
||||
await db.execute("UPDATE autorole SET bots = ? WHERE guild_id = ?", (str(bots), ctx.guild.id))
|
||||
await db.execute("UPDATE autorole SET bots = ? WHERE guild_id = ?", (dump_role_id_list(bots), ctx.guild.id))
|
||||
await db.commit()
|
||||
view = CV2(f"{TICK} Success", f"{role.mention} has been removed from bot autoroles.")
|
||||
else:
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
from discord.ext import commands
|
||||
from discord.ui import View, Button, button
|
||||
import discord
|
||||
from utils.safe_parse import safe_math_eval
|
||||
|
||||
|
||||
class CalculatorView(View):
|
||||
@@ -89,7 +90,7 @@ class CalculatorView(View):
|
||||
)
|
||||
try:
|
||||
expression = self.value.strip().replace("\n", "")
|
||||
result = str(eval(expression))
|
||||
result = safe_math_eval(expression)
|
||||
await self.update_embed(interaction, result)
|
||||
self.value = result # Store the result for possible further calculations
|
||||
except:
|
||||
|
||||
@@ -38,11 +38,6 @@ from typing import *
|
||||
import string
|
||||
from utils.cv2 import CV2, build_container
|
||||
|
||||
lawda = [
|
||||
'8', '3821', '23', '21', '313', '43', '29', '76', '11', '9',
|
||||
'44', '470', '318' , '26', '69'
|
||||
]
|
||||
|
||||
|
||||
class AvatarView(View):
|
||||
def __init__(self, user, member, author_id, banner_url):
|
||||
@@ -214,55 +209,6 @@ class General(commands.Cog):
|
||||
await msg.add_reaction(CROSS)
|
||||
|
||||
|
||||
@commands.command(name="hack",
|
||||
help="hack someone's discord account",
|
||||
usage="Hack <member>")
|
||||
@blacklist_check()
|
||||
@ignore_check()
|
||||
@commands.cooldown(1, 3, commands.BucketType.user)
|
||||
async def hack(self, ctx: commands.Context, member: discord.Member):
|
||||
stringi = member.name
|
||||
min_length = 2
|
||||
max_length = 12
|
||||
length = random.randint(min_length, max_length)
|
||||
stringg = member.name
|
||||
remaining_length = length - len(stringg)
|
||||
all_chars = string.ascii_letters + string.digits + string.punctuation
|
||||
random_chars = random.choices(all_chars, k=remaining_length)
|
||||
|
||||
password = stringg + ''.join(random_chars)
|
||||
|
||||
lund = await ctx.send(f"Processing to Hack {member.mention}...")
|
||||
await asyncio.sleep(2)
|
||||
random_pass = random.choice(lawda)
|
||||
|
||||
random_pass2 = ''.join(random.choices(string.ascii_letters + string.digits, k=3))
|
||||
hack_text = (
|
||||
f"**User:** {member.mention}\n"
|
||||
f"**E-Mail:** {''.join(c for c in stringi if c.isalnum())}{random_pass}@gmail.com\n"
|
||||
f"**Account Password:** {member.name}@{random_pass2}"
|
||||
)
|
||||
await ctx.send(view=CV2(f"Hacked {member.display_name}!", hack_text))
|
||||
await lund.delete()
|
||||
|
||||
|
||||
@commands.command(name="token", usage="Token <member>")
|
||||
@blacklist_check()
|
||||
@ignore_check()
|
||||
@commands.cooldown(1, 2, commands.BucketType.user)
|
||||
async def token(self, ctx: commands.Context, user: discord.Member = None):
|
||||
list = [
|
||||
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N",
|
||||
"O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "_"
|
||||
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
||||
'ñ', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0',
|
||||
'1', '2', '3', '4', '5', '6', '7', '8', '9'
|
||||
]
|
||||
token = random.choices(list, k=59)
|
||||
if user is None:
|
||||
user = ctx.author
|
||||
await ctx.send(view=CV2("🔐 Token", f"{user.mention}'s token: `{''.join(token)}`"))
|
||||
|
||||
@commands.command(name="users", help=f"checks total users of {BotName}.")
|
||||
@blacklist_check()
|
||||
@ignore_check()
|
||||
@@ -274,34 +220,6 @@ class General(commands.Cog):
|
||||
await ctx.send(view=CV2(f"{BotName} Users", f"❯ Total of __**{users}**__ Users in **{guilds}** Guilds"))
|
||||
|
||||
|
||||
@commands.command(name="wizz", usage="Wizz")
|
||||
@blacklist_check()
|
||||
@ignore_check()
|
||||
@commands.cooldown(1, 3, commands.BucketType.user)
|
||||
async def wizz(self, ctx: commands.Context):
|
||||
message6 = await ctx.send(
|
||||
f"`Wizzing {ctx.guild.name}, will take 22 seconds to complete`")
|
||||
message7 = await ctx.send(f"Changing all guild settings...")
|
||||
message5 = await ctx.send(f"Deleting **{len(ctx.guild.roles)}** Roles...")
|
||||
await asyncio.sleep(1)
|
||||
message4 = await ctx.send(
|
||||
f"Deleting **{len(ctx.guild.channels)}** Channels...")
|
||||
await asyncio.sleep(1)
|
||||
message3 = await ctx.send(f"Deleting Webhooks...")
|
||||
message2 = await ctx.send(f"Deleting emojis")
|
||||
await asyncio.sleep(1)
|
||||
message1 = await ctx.send(f"Installing Ban Wave..")
|
||||
await asyncio.sleep(1)
|
||||
await message6.delete()
|
||||
await message7.delete()
|
||||
await message5.delete()
|
||||
await message4.delete()
|
||||
await message3.delete()
|
||||
await message2.delete()
|
||||
await message1.delete()
|
||||
await ctx.send(view=CV2(f"{self.bot.user.name}", f"**{ZWARNING} Successfully Wizzed {ctx.guild.name}**"))
|
||||
|
||||
|
||||
@commands.hybrid_command(
|
||||
name="urban",
|
||||
description="Searches for specified phrase on urbandictionary",
|
||||
|
||||
@@ -128,7 +128,7 @@ class TimeSelect(Select):
|
||||
if role:
|
||||
await member.add_roles(role, reason="No prefix added")
|
||||
|
||||
log_channel = interaction.client.get_channel(1396794297386532978)
|
||||
log_channel = interaction.client.get_channel(LOG_CHANNEL_ID) if LOG_CHANNEL_ID else None
|
||||
if log_channel:
|
||||
embed = CV2Embed(
|
||||
title="User Added to No Prefix",
|
||||
@@ -140,7 +140,7 @@ class TimeSelect(Select):
|
||||
if self.user.avatar
|
||||
else self.user.default_avatar.url
|
||||
)
|
||||
await log_channel.send("<#1396794297386532978>", view=embed)
|
||||
await log_channel.send(view=embed)
|
||||
|
||||
embed = CV2Embed(
|
||||
description=f"**Added Global No Prefix**:\n{ZHUMAN} User: **{self.user.mention}**\n{MENTION} User Mention: {self.user.mention}\n{ZYROXSYS} User ID: {self.user.id}\n\n__**Additional Info**__:\n{ZYROXHAMMER} Added By: **{self.author.display_name}**\n{TIME} Expiry Time: {expiry_text}\n{BOOST} Timestamp: {expiry_timestamp}",
|
||||
@@ -233,7 +233,7 @@ class NoPrefix(commands.Cog):
|
||||
for user_id in expired_users:
|
||||
user = self.client.get_user(user_id)
|
||||
if user:
|
||||
log_channel = self.client.get_channel(1396794297386532978)
|
||||
log_channel = self.client.get_channel(LOG_CHANNEL_ID) if LOG_CHANNEL_ID else None
|
||||
if log_channel:
|
||||
embed_log = CV2Embed(
|
||||
title="No Prefix Expired",
|
||||
@@ -251,9 +251,7 @@ class NoPrefix(commands.Cog):
|
||||
else user.default_avatar.url
|
||||
)
|
||||
embed_log.set_footer(text="No Prefix Removal Log")
|
||||
await log_channel.send(
|
||||
"<#1396794297386532978>", view=embed_log
|
||||
)
|
||||
await log_channel.send(view=embed_log)
|
||||
bot = self.client
|
||||
guild = bot.get_guild(1401125905677553716)
|
||||
if guild:
|
||||
@@ -402,7 +400,7 @@ class NoPrefix(commands.Cog):
|
||||
embed.set_author(name="Removed No Prefix")
|
||||
await ctx.reply(view=embed)
|
||||
|
||||
log_channel = ctx.bot.get_channel(1396794297386532978)
|
||||
log_channel = ctx.bot.get_channel(LOG_CHANNEL_ID) if LOG_CHANNEL_ID else None
|
||||
if log_channel:
|
||||
embed_log = CV2Embed(
|
||||
title="No Prefix Removed",
|
||||
@@ -694,7 +692,7 @@ class NoPrefix(commands.Cog):
|
||||
await interaction.response.edit_message(view=success_embed)
|
||||
|
||||
# Log the action
|
||||
log_channel = self.client.get_channel(1396794297386532978)
|
||||
log_channel = self.client.get_channel(LOG_CHANNEL_ID) if LOG_CHANNEL_ID else None
|
||||
if log_channel:
|
||||
log_embed = CV2Embed(
|
||||
title="No-Prefix List Reset",
|
||||
@@ -702,7 +700,7 @@ class NoPrefix(commands.Cog):
|
||||
color=0xFF0000,
|
||||
)
|
||||
log_embed.set_footer(text="No Prefix Reset Log")
|
||||
await log_channel.send("<#1396794297386532978>", view=log_embed)
|
||||
await log_channel.send(view=log_embed)
|
||||
|
||||
async def no_callback(interaction):
|
||||
if interaction.user != ctx.author:
|
||||
|
||||
Reference in New Issue
Block a user