Skip to content

Commit

Permalink
Merge pull request Ikaros-521#844 from Ikaros-521/owner
Browse files Browse the repository at this point in the history
修复变量使用错误问题
  • Loading branch information
Ikaros-521 authored May 19, 2024
2 parents 9f0eb04 + 8cd6368 commit 433da79
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions utils/my_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -1336,7 +1336,7 @@ def get_copywriting_and_audio_synthesis(sign_num):
"sign_num": sign_num + 1
}

resp_content = self.common.dynamic_variable_replacement(resp_content, data_json)
resp_content = My_handle.common.dynamic_variable_replacement(resp_content, data_json)

# 括号语法替换
resp_content = My_handle.common.brackets_text_randomize(resp_content)
Expand Down Expand Up @@ -1460,7 +1460,7 @@ def get_copywriting_and_audio_synthesis(total_price):
resp_content = My_handle.common.brackets_text_randomize(resp_content)

# 动态变量替换
resp_content = self.common.dynamic_variable_replacement(resp_content, data_json)
resp_content = My_handle.common.dynamic_variable_replacement(resp_content, data_json)

# 生成回复内容
message = {
Expand Down Expand Up @@ -1553,7 +1553,7 @@ def get_copywriting_and_audio_synthesis(view_num):
"entrance_num": view_num + 1
}

resp_content = self.common.dynamic_variable_replacement(resp_content, data_json)
resp_content = My_handle.common.dynamic_variable_replacement(resp_content, data_json)

# 括号语法替换
resp_content = My_handle.common.brackets_text_randomize(resp_content)
Expand Down Expand Up @@ -1650,7 +1650,7 @@ def get_copywriting_and_audio_synthesis(total_integral):
"integral": total_integral
}

resp_content = self.common.dynamic_variable_replacement(resp_content, data_json)
resp_content = My_handle.common.dynamic_variable_replacement(resp_content, data_json)

# 如果积分为0,则返回个没积分的回复。不过这个基本没可能,除非有bug
if total_integral == 0:
Expand Down Expand Up @@ -1724,7 +1724,7 @@ def get_a_copywriting_and_audio_synthesis(key_mapping_config, data):
'total_price': data["total_price"],
'cur_time': My_handle.common.get_bj_time(5),
}
tmp = self.common.dynamic_variable_replacement(tmp, data_json)
tmp = My_handle.common.dynamic_variable_replacement(tmp, data_json)

# 音频合成时需要用到的重要数据
message = {
Expand Down Expand Up @@ -2181,12 +2181,12 @@ def comment_handle(self, data):
# 判断是否需要念用户名
if My_handle.config.get("read_comment", "read_username_enable"):
# 将用户名中特殊字符替换为空
message['username'] = self.common.replace_special_characters(message['username'], "!!@#¥$%^&*_-+/——=()()【】}|{:;<>~`\\")
message['username'] = My_handle.common.replace_special_characters(message['username'], "!!@#¥$%^&*_-+/——=()()【】}|{:;<>~`\\")
message['username'] = message['username'][:self.config.get("read_comment", "username_max_len")]

# 将用户名字符串中的数字转换成中文
if My_handle.config.get("filter", "username_convert_digits_to_chinese"):
message["username"] = self.common.convert_digits_to_chinese(message["username"])
message["username"] = My_handle.common.convert_digits_to_chinese(message["username"])
logging.debug(f"用户名字符串中的数字转换成中文:{message['username']}")

if len(self.config.get("read_comment", "read_username_copywriting")) > 0:
Expand Down Expand Up @@ -2388,7 +2388,7 @@ def gift_handle(self, data):

# 将用户名字符串中的数字转换成中文
if My_handle.config.get("filter", "username_convert_digits_to_chinese"):
data["username"] = self.common.convert_digits_to_chinese(data["username"])
data["username"] = My_handle.common.convert_digits_to_chinese(data["username"])

# logging.debug(f"[{data['username']}]: {data}")

Expand Down Expand Up @@ -2422,7 +2422,7 @@ def gift_handle(self, data):
'total_price': data["total_price"],
'cur_time': My_handle.common.get_bj_time(5),
}
resp_content = self.common.dynamic_variable_replacement(resp_content, data_json)
resp_content = My_handle.common.dynamic_variable_replacement(resp_content, data_json)


message = {
Expand Down Expand Up @@ -2471,7 +2471,7 @@ def entrance_handle(self, data):

# 将用户名字符串中的数字转换成中文
if My_handle.config.get("filter", "username_convert_digits_to_chinese"):
data["username"] = self.common.convert_digits_to_chinese(data["username"])
data["username"] = My_handle.common.convert_digits_to_chinese(data["username"])

# logging.debug(f"[{data['username']}]: {data['content']}")

Expand Down Expand Up @@ -2527,7 +2527,7 @@ def follow_handle(self, data):

# 将用户名字符串中的数字转换成中文
if My_handle.config.get("filter", "username_convert_digits_to_chinese"):
data["username"] = self.common.convert_digits_to_chinese(data["username"])
data["username"] = My_handle.common.convert_digits_to_chinese(data["username"])

# logging.debug(f"[{data['username']}]: {data['content']}")

Expand Down Expand Up @@ -2571,7 +2571,7 @@ def schedule_handle(self, data):

# 将用户名字符串中的数字转换成中文
if My_handle.config.get("filter", "username_convert_digits_to_chinese"):
data["username"] = self.common.convert_digits_to_chinese(data["username"])
data["username"] = My_handle.common.convert_digits_to_chinese(data["username"])

message = {
"type": "schedule",
Expand Down Expand Up @@ -2599,7 +2599,7 @@ def idle_time_task_handle(self, data):

# 将用户名字符串中的数字转换成中文
if My_handle.config.get("filter", "username_convert_digits_to_chinese"):
username = self.common.convert_digits_to_chinese(username)
username = My_handle.common.convert_digits_to_chinese(username)

if type == "reread":
# 输出当前用户发送的弹幕消息
Expand Down Expand Up @@ -2801,7 +2801,7 @@ def image_recognition_schedule_handle(self, data):

# 将用户名字符串中的数字转换成中文
if My_handle.config.get("filter", "username_convert_digits_to_chinese"):
username = self.common.convert_digits_to_chinese(username)
username = My_handle.common.convert_digits_to_chinese(username)

if type == "窗口截图":
# 根据窗口名截图
Expand Down Expand Up @@ -2998,7 +2998,7 @@ def talk_handle(self, data):
# 判断是否需要念用户名
if My_handle.config.get("read_comment", "read_username_enable"):
# 将用户名中特殊字符替换为空
message['username'] = self.common.replace_special_characters(message['username'], "!!@#¥$%^&*_-+/——=()()【】}|{:;<>~`\\")
message['username'] = My_handle.common.replace_special_characters(message['username'], "!!@#¥$%^&*_-+/——=()()【】}|{:;<>~`\\")
message['username'] = message['username'][:self.config.get("read_comment", "username_max_len")]

if len(self.config.get("read_comment", "read_username_copywriting")) > 0:
Expand Down

0 comments on commit 433da79

Please sign in to comment.