27 lines
492 B
Python
27 lines
492 B
Python
path = r"E:\GitHub\blog\bot-go\internal\tgcore\tgcore.go"
|
|||
|
|
with open(path, "rb") as f:
|
||
|
|
content = f.read().decode("utf-8")
|
||
|
|
|
||
|
|
# Add missing imports
|
||
|
|
old_import = '''import (
|
||
|
|
"encoding/json"
|
||
|
|
"fmt"
|
||
|
|
"io"
|
||
|
|
"net/http"
|
||
|
|
"strings"
|
||
|
|
)'''
|
||
|
|
new_import = '''import (
|
||
|
|
"encoding/json"
|
||
|
|
"fmt"
|
||
|
|
"io"
|
||
|
|
"net"
|
||
|
|
"net/http"
|
||
|
|
"strings"
|
||
|
|
"time"
|
||
|
|
)'''
|
||
|
|
|
||
|
|
content = content.replace(old_import, new_import)
|
||
|
|
|
||
|
|
with open(path, "wb") as f:
|
||
|
|
f.write(content.encode("utf-8"))
|
||
|
|
print("Added net, time imports to tgcore")
|