fix (schedule): Require existent Channels.
This commit is contained in:
@@ -51,6 +51,8 @@ class ScheduleSettings(SettingGroup):
|
|||||||
|
|
||||||
_model = ScheduleData.ScheduleGuild
|
_model = ScheduleData.ScheduleGuild
|
||||||
_column = ScheduleData.ScheduleGuild.lobby_channel.name
|
_column = ScheduleData.ScheduleGuild.lobby_channel.name
|
||||||
|
_allow_object = False
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def update_message(self):
|
def update_message(self):
|
||||||
@@ -110,6 +112,7 @@ class ScheduleSettings(SettingGroup):
|
|||||||
|
|
||||||
_model = ScheduleData.ScheduleGuild
|
_model = ScheduleData.ScheduleGuild
|
||||||
_column = ScheduleData.ScheduleGuild.room_channel.name
|
_column = ScheduleData.ScheduleGuild.room_channel.name
|
||||||
|
_allow_object = False
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def update_message(self):
|
def update_message(self):
|
||||||
@@ -424,6 +427,7 @@ class ScheduleSettings(SettingGroup):
|
|||||||
|
|
||||||
_model = ScheduleData.ScheduleGuild
|
_model = ScheduleData.ScheduleGuild
|
||||||
_column = ScheduleData.ScheduleGuild.blacklist_role.name
|
_column = ScheduleData.ScheduleGuild.blacklist_role.name
|
||||||
|
_allow_object = False
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def update_message(self):
|
def update_message(self):
|
||||||
|
|||||||
@@ -237,6 +237,7 @@ class ChannelSetting(Generic[ParentID, CT], InteractiveSetting[ParentID, int, CT
|
|||||||
|
|
||||||
_selector_placeholder = "Select a Channel"
|
_selector_placeholder = "Select a Channel"
|
||||||
channel_types: list[discord.ChannelType] = []
|
channel_types: list[discord.ChannelType] = []
|
||||||
|
_allow_object = True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _data_from_value(cls, parent_id, value, **kwargs):
|
def _data_from_value(cls, parent_id, value, **kwargs):
|
||||||
@@ -255,7 +256,7 @@ class ChannelSetting(Generic[ParentID, CT], InteractiveSetting[ParentID, int, CT
|
|||||||
if data is not None:
|
if data is not None:
|
||||||
bot = ctx_bot.get()
|
bot = ctx_bot.get()
|
||||||
channel = bot.get_channel(data)
|
channel = bot.get_channel(data)
|
||||||
if channel is None:
|
if channel is None and cls._allow_object:
|
||||||
channel = discord.Object(id=data)
|
channel = discord.Object(id=data)
|
||||||
return channel
|
return channel
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user