def messageToEmbed(message):
# Get some default values that'll be in the embed
author = message.author
description = message.content
image = False
# Check to see if any images were added
regexMatch = r'.+(.png)|.+(.jpg)|.+(.jpeg)|.+(.gif)'
if len(message.attachments) > 0:
attachment = message.attachments[0]
matchList = [i for i in finditer(regexMatch, attachment['filename'])]
if len(matchList) > 0:
image = attachment['url']
# Get the time the message was created
createdTime = '.'.join(str(message.timestamp).split('.')[:-1])
# Make and return the embed
return makeEmbed(user=author, description=description, image=image, footer=createdTime)
评论列表
文章目录