Have to make sure things exist before making list of them.
Don't delete the embed before done using it.
This commit is contained in:
+13
-13
@@ -76,8 +76,6 @@ class RecordCog(commands.Cog, name="Record Commands"):
|
|||||||
embed=embed,
|
embed=embed,
|
||||||
)
|
)
|
||||||
|
|
||||||
# add points to table
|
|
||||||
|
|
||||||
|
|
||||||
class EventView(nextcord.ui.View):
|
class EventView(nextcord.ui.View):
|
||||||
"""
|
"""
|
||||||
@@ -125,6 +123,19 @@ class EventView(nextcord.ui.View):
|
|||||||
Submits the event embed to the event channel. Removes view and embed from recording message.
|
Submits the event embed to the event channel. Removes view and embed from recording message.
|
||||||
Sends point information to database.
|
Sends point information to database.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
discord_users = self.event_participants.values.members
|
||||||
|
if discord_users:
|
||||||
|
discord_users_list: list[str] = [str(user.id) for user in discord_users]
|
||||||
|
record_event_participation(self.config, discord_users_list, True)
|
||||||
|
|
||||||
|
non_discord_users = interaction.message.embeds[0].fields[1].value
|
||||||
|
if non_discord_users:
|
||||||
|
non_discord_users_list: list[str] = non_discord_users.split("\n")
|
||||||
|
record_event_participation(self.config, non_discord_users_list, False)
|
||||||
|
|
||||||
|
record_event_host(self.config, self.host_id)
|
||||||
|
|
||||||
event_channel: nextcord.TextChannel = interaction.guild.get_channel(
|
event_channel: nextcord.TextChannel = interaction.guild.get_channel(
|
||||||
self.config.params.event_post_channel_id
|
self.config.params.event_post_channel_id
|
||||||
)
|
)
|
||||||
@@ -133,17 +144,6 @@ class EventView(nextcord.ui.View):
|
|||||||
content="Event has been submitted.", view=None, embed=None
|
content="Event has been submitted.", view=None, embed=None
|
||||||
)
|
)
|
||||||
|
|
||||||
discord_users: list[str] = [
|
|
||||||
str(user.id) for user in self.event_participants.values.members
|
|
||||||
]
|
|
||||||
non_discord_users: list[str] = (
|
|
||||||
interaction.message.embeds[0].fields[1].value.split("\n")
|
|
||||||
)
|
|
||||||
|
|
||||||
record_event_participation(self.config, discord_users, True)
|
|
||||||
record_event_participation(self.config, non_discord_users, False)
|
|
||||||
record_event_host(self.config, self.host_id)
|
|
||||||
|
|
||||||
self.stop()
|
self.stop()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user