Fixed channel for get channel name can be None #362
This commit is contained in:
parent
9226a1188e
commit
f72ea68f66
@ -39,7 +39,10 @@ class UserJoinedVoiceChannel(TableABC):
|
||||
@property
|
||||
@ServiceProviderABC.inject
|
||||
def channel_name(self, bot: DiscordBotServiceABC) -> str:
|
||||
return bot.get_channel(self.channel_id).name
|
||||
channel = bot.get_channel(self.channel_id)
|
||||
if channel is None:
|
||||
return ""
|
||||
return channel.name
|
||||
|
||||
@property
|
||||
def user(self) -> User:
|
||||
|
@ -41,7 +41,10 @@ class UserJoinedVoiceChannelHistory(HistoryTableABC):
|
||||
@property
|
||||
@ServiceProviderABC.inject
|
||||
def channel_name(self, bot: DiscordBotServiceABC) -> str:
|
||||
return bot.get_channel(self.channel_id).name
|
||||
channel = bot.get_channel(self.channel_id)
|
||||
if channel is None:
|
||||
return ""
|
||||
return channel.name
|
||||
|
||||
@property
|
||||
def user(self) -> int:
|
||||
|
Loading…
Reference in New Issue
Block a user