snapshot before merge
This commit is contained in:
1 parent
2b3b2850f9
commit
21fc65b3ae
145 files changed
+9786
-59
No files matched your search
@@ -0,0 +1,33 @@
|
||||
path = r"E:\GitHub\blog\bot-go\internal\tghandlers\tghandlers.go"
|
||||
with open(path, "rb") as f:
|
||||
content = f.read().decode("utf-8")
|
||||
|
||||
# Fix line 117: non-boolean condition
|
||||
# The Stop function was using writeserver.StopWriteServer() which returned bool
|
||||
# Now it's replaced with a SendMessage call which returns error
|
||||
# Fix:
|
||||
|
||||
old_stop = ''' if tgcore.SendMessage(chatID, "WriteServer stop not available in bot-only mode.", nil) {
|
||||
tgcore.SendMessage(chatID, "⚡ Write 已停止。", nil)
|
||||
} else {
|
||||
tgcore.SendMessage(chatID, "⏸ Write 未运行。", nil)
|
||||
}'''
|
||||
|
||||
new_stop = ''' tgcore.SendMessage(chatID, "WriteServer 已与 Bot 合并,无需单独启停。", nil)'''
|
||||
|
||||
content = content.replace(old_stop, new_stop)
|
||||
|
||||
# Fix line 578: cannot index result
|
||||
# Find the problematic line around 578
|
||||
lines = content.split("\n")
|
||||
for i, line in enumerate(lines):
|
||||
if i >= 575 and i <= 582:
|
||||
print(f" {i+1}: {line}")
|
||||
|
||||
# Fix writeserver.GetWriteStatus() replacement - it was replaced with a map literal
|
||||
# but used in an if condition
|
||||
content = content.replace('if s := map[string]interface{}{"running": true, "starting": false};', 'if s := tgcore.GetWriteStatus();')
|
||||
|
||||
with open(path, "wb") as f:
|
||||
f.write(content.encode("utf-8"))
|
||||
print("\nFixed Stop and GetWriteStatus")
|
||||
Reference in new issue
Block a user