qwdqwdq
This commit is contained in:
16
main.py
16
main.py
@@ -37,18 +37,30 @@ app = FastAPI()
|
|||||||
|
|
||||||
# 转换emoji字符串为[]
|
# 转换emoji字符串为[]
|
||||||
def transOldemoji(oldEmoji=None):
|
def transOldemoji(oldEmoji=None):
|
||||||
# oldEmoji = "异度世界🤖"
|
oldEmoji = "异度世界🤖"
|
||||||
original_string = WXBotService.emoji_to_unicode(oldEmoji)
|
original_string = WXBotService.emoji_to_unicode(oldEmoji)
|
||||||
print("original_string", original_string)
|
print("original_string", original_string)
|
||||||
|
# # 全局替换 \\u 为 @emoji=
|
||||||
|
# converted_string = original_string.replace('\\\\u', '@emoji=')
|
||||||
|
# # 在 Unicode 编码后添加 ']'
|
||||||
|
# converted_string = converted_string[:-1] + ']'
|
||||||
|
# # 输出转换后的字符串
|
||||||
|
# print(converted_string)
|
||||||
|
# return converted_string
|
||||||
# 全局替换 \\u 为 @emoji=
|
# 全局替换 \\u 为 @emoji=
|
||||||
converted_string = original_string.replace('\\u', '@emoji=')
|
converted_string = original_string.replace('\\u', '@emoji=')
|
||||||
|
|
||||||
# 在 Unicode 编码后添加 ']'
|
# 在 Unicode 编码后添加 ']'
|
||||||
converted_string = converted_string[:-1] + ']'
|
# 如果原始字符串中的 \\uXXX 是在方括号中,需要保留方括号
|
||||||
|
# 替换后,如果需要,可以调整这一步骤,根据特定需求
|
||||||
|
converted_string = re.sub(r'\[@emoji=[0-9a-fA-F]{4}\]', lambda match: f'{match.group()}]', converted_string)
|
||||||
|
|
||||||
# 输出转换后的字符串
|
# 输出转换后的字符串
|
||||||
print(converted_string)
|
print(converted_string)
|
||||||
return converted_string
|
return converted_string
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Dependency
|
# Dependency
|
||||||
def get_db():
|
def get_db():
|
||||||
db = SessionLocal()
|
db = SessionLocal()
|
||||||
|
|||||||
Reference in New Issue
Block a user