rewrite: Small bugfixes.
This commit is contained in:
@@ -757,6 +757,6 @@ class TasklistCog(LionCog):
|
|||||||
|
|
||||||
if ctx.channel.id not in TasklistConfigUI._listening or not ctx.interaction.response.is_done():
|
if ctx.channel.id not in TasklistConfigUI._listening or not ctx.interaction.response.is_done():
|
||||||
# Launch setting group UI
|
# Launch setting group UI
|
||||||
configui = TasklistConfigUI(self.bot, self.settings, ctx.guild.id, ctx.channel.id)
|
configui = TasklistConfigUI(self.bot, ctx.guild.id, ctx.channel.id)
|
||||||
await configui.run(ctx.interaction)
|
await configui.run(ctx.interaction)
|
||||||
await configui.wait()
|
await configui.wait()
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ from settings.groups import SettingGroup
|
|||||||
|
|
||||||
from meta import conf, LionBot
|
from meta import conf, LionBot
|
||||||
from utils.lib import tabulate
|
from utils.lib import tabulate
|
||||||
from utils.ui import LeoUI, FastModal, error_handler_for, ModalRetryUI
|
from utils.ui import LeoUI, FastModal, error_handler_for, ModalRetryUI, DashboardSection
|
||||||
from core.data import CoreData
|
from core.data import CoreData
|
||||||
from babel.translator import ctx_translator
|
from babel.translator import ctx_translator
|
||||||
|
|
||||||
@@ -128,14 +128,19 @@ class TasklistSettings(SettingGroup):
|
|||||||
|
|
||||||
|
|
||||||
class TasklistConfigUI(LeoUI):
|
class TasklistConfigUI(LeoUI):
|
||||||
# TODO: Back option to globall guild config
|
# TODO: Back option to global guild config
|
||||||
# TODO: Cohesive edit
|
# TODO: Cohesive edit
|
||||||
_listening = {}
|
_listening = {}
|
||||||
|
setting_classes = (
|
||||||
|
TasklistSettings.task_reward,
|
||||||
|
TasklistSettings.task_reward_limit,
|
||||||
|
TasklistSettings.tasklist_channels
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, bot: LionBot, settings: TasklistSettings, guildid: int, channelid: int, **kwargs):
|
def __init__(self, bot: LionBot, guildid: int, channelid: int, **kwargs):
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
self.settings = settings
|
self.settings: TasklistSettings = bot.get_cog('TasklistCog').settings
|
||||||
self.guildid = guildid
|
self.guildid = guildid
|
||||||
self.channelid = channelid
|
self.channelid = channelid
|
||||||
|
|
||||||
@@ -168,8 +173,8 @@ class TasklistConfigUI(LeoUI):
|
|||||||
elif self._original:
|
elif self._original:
|
||||||
await self._original.delete_original_response()
|
await self._original.delete_original_response()
|
||||||
self._original = None
|
self._original = None
|
||||||
except discord.HTTPException:
|
|
||||||
pass
|
pass
|
||||||
|
except discord.HTTPException:
|
||||||
await self.close()
|
await self.close()
|
||||||
|
|
||||||
@button(label='RESET_PLACEHOLDER')
|
@button(label='RESET_PLACEHOLDER')
|
||||||
@@ -278,3 +283,9 @@ class TasklistConfigUI(LeoUI):
|
|||||||
for setting in self.instances:
|
for setting in self.instances:
|
||||||
embed.add_field(**setting.embed_field, inline=False)
|
embed.add_field(**setting.embed_field, inline=False)
|
||||||
return embed
|
return embed
|
||||||
|
|
||||||
|
|
||||||
|
class TasklistDashboard(DashboardSection):
|
||||||
|
section_name = _p('dash:tasklist|name', "Tasklist Configuration")
|
||||||
|
configui = TasklistConfigUI
|
||||||
|
setting_classes = configui.setting_classes
|
||||||
|
|||||||
@@ -351,7 +351,7 @@ class TasklistUI(BasePager):
|
|||||||
return False
|
return False
|
||||||
if message.attachments or message.embeds or height > 20:
|
if message.attachments or message.embeds or height > 20:
|
||||||
return False
|
return False
|
||||||
height += len(message.content.count('\n'))
|
height += message.content.count('\n')
|
||||||
return False
|
return False
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user