Fix some bugs
This commit is contained in:
@@ -144,7 +144,7 @@ class Admin(commands.Cog, name="settings"):
|
||||
embed.set_thumbnail(url=ctx.guild.icon.url)
|
||||
|
||||
embed.add_field(name=get_lang(ctx.guild.id, 'settingsTitle'), value=get_lang(ctx.guild.id, 'settingsValue').format(
|
||||
settings.get('prefix', func.settings.bot_prefix),
|
||||
settings.get('prefix', func.settings.bot_prefix) or "None",
|
||||
settings.get('lang', 'EN'),
|
||||
settings.get('controller', True),
|
||||
f"<@&{settings['dj']}>" if 'dj' in settings else '`None`',
|
||||
@@ -225,7 +225,7 @@ class Admin(commands.Cog, name="settings"):
|
||||
player, settings = self.get_settings(ctx)
|
||||
controller_settings = settings.get("default_controller", func.settings.controller)
|
||||
|
||||
view = EmbedBuilderView(ctx.author, controller_settings.get("embeds"))
|
||||
view = EmbedBuilderView(ctx.author, controller_settings.get("embeds").copy())
|
||||
message = await ctx.send(embed=view.build_embed(), view=view)
|
||||
view.response = message
|
||||
|
||||
|
||||
5
main.py
5
main.py
@@ -41,7 +41,10 @@ class Vocard(commands.Bot):
|
||||
return False
|
||||
|
||||
if self.user.mentioned_in(message) and not message.mention_everyone:
|
||||
await message.channel.send(f"My prefix is `{await self.command_prefix(self, message)}`")
|
||||
prefix = await self.command_prefix(self, message)
|
||||
if not prefix:
|
||||
return await message.channel.send("I don't have a bot prefix set.")
|
||||
await message.channel.send(f"My prefix is `{prefix}`")
|
||||
|
||||
await self.process_commands(message)
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import discord
|
||||
import function as func
|
||||
import copy
|
||||
|
||||
from typing import List
|
||||
|
||||
@@ -43,8 +44,8 @@ class EmbedBuilderView(discord.ui.View):
|
||||
self.author: discord.Member = author
|
||||
self.response: discord.Message = None
|
||||
|
||||
self.original_data: dict = data.copy()
|
||||
self.data: dict = data.copy()
|
||||
self.original_data: dict = copy.deepcopy(data)
|
||||
self.data: dict = copy.deepcopy(data)
|
||||
self.embedType: str = "active"
|
||||
|
||||
self.ph: Placeholders = Placeholders()
|
||||
@@ -106,14 +107,17 @@ class EmbedBuilderView(discord.ui.View):
|
||||
await modal.wait()
|
||||
|
||||
v = modal.values
|
||||
data["description"] = v["description"]
|
||||
data["color"] = v["color"]
|
||||
try:
|
||||
data["description"] = v["description"]
|
||||
data["color"] = int(v["color"], 16)
|
||||
|
||||
if "title" not in data:
|
||||
data["title"] = {}
|
||||
if "title" not in data:
|
||||
data["title"] = {}
|
||||
|
||||
data["title"]["name"] = v['title']
|
||||
data["title"]["url"] = v['url']
|
||||
data["title"]["name"] = v['title']
|
||||
data["title"]["url"] = v['url']
|
||||
except:
|
||||
pass
|
||||
|
||||
return await interaction.edit_original_response(embed=self.build_embed())
|
||||
|
||||
@@ -314,10 +318,14 @@ class EmbedBuilderView(discord.ui.View):
|
||||
await interaction.response.defer()
|
||||
self.stop()
|
||||
|
||||
@discord.ui.button(label="Cancel", style=discord.ButtonStyle.red, row=1)
|
||||
async def cancel(self, interaction: discord.Interaction, button: discord.ui.Button):
|
||||
|
||||
self.data = self.original_data.copy()
|
||||
@discord.ui.button(label="Reset", style=discord.ButtonStyle.red, row=1)
|
||||
async def reset(self, interaction: discord.Interaction, button: discord.ui.Button):
|
||||
self.data.update(copy.deepcopy(self.original_data))
|
||||
return await interaction.response.edit_message(embed=self.build_embed())
|
||||
|
||||
@discord.ui.button(emoji='🗑️', row=1)
|
||||
async def stop_button(self, interaction: discord.Interaction, button: discord.ui.Button):
|
||||
await self.response.delete()
|
||||
self.stop()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user