fix (context): Fix ctx repr in private channels.

This commit is contained in:
2023-08-22 23:11:46 +03:00
parent 319f132d5d
commit d93f31d295

View File

@@ -4,6 +4,7 @@ from collections import namedtuple
from typing import Optional, TYPE_CHECKING
import discord
from discord.enums import ChannelType
from discord.ext.commands import Context
if TYPE_CHECKING:
@@ -64,6 +65,9 @@ class LionContext(Context['LionBot']):
parts['uname'] = f"\"{self.author.name}\""
if self.channel is not None:
parts['cid'] = self.channel.id
if self.channel.type is ChannelType.private:
parts['cname'] = f"\"{self.channel.recipient}\""
else:
parts['cname'] = f"\"{self.channel.name}\""
if self.guild is not None:
parts['gid'] = self.guild.id