def on_message(self, message):
"""Called on `Client.on_message`, Message handling happens here"""
if message.content.startswith("_") and message.content.endswith("_"):
message.content = "/me " + message.content[1:-1]
if isinstance(message.channel, discord.PrivateChannel):
if not message.channel.name:
message.channel.name = ",".join(map(lambda m: m.display_name, message.channel.recipients))
if message.channel.type is discord.ChannelType.group:
tab = self.gui.start_privmsg(message.channel)
else:
tab = self.gui.start_privmsg(message.channel)
fmt = fmt_disp_msg(self, message.content, message, user=message.author)
if fmt:
tab.display_text(fmt)
else:
if self.gui.memosWindow:
if message.server in self.gui.memosWindow.open.keys():
fmt = fmt_disp_msg(self, message.content, message, user=message.author)
if fmt:
try:
self.gui.memosWindow.display_message(message.channel, fmt)
except AttributeError as e:
print(e)
评论列表
文章目录