FUCK YOU GBK
This commit is contained in:
parent
0797ea3967
commit
016450340a
6 changed files with 18 additions and 3 deletions
11
bot.py
11
bot.py
|
@ -1,3 +1,4 @@
|
|||
import sys
|
||||
import traceback
|
||||
|
||||
from init import init_bot
|
||||
|
@ -6,6 +7,13 @@ import os
|
|||
import subprocess
|
||||
from queue import Queue, Empty
|
||||
from threading import Thread
|
||||
import locale
|
||||
|
||||
|
||||
encode = 'UTF-8'
|
||||
if locale.getdefaultlocale()[1] == 'cp936':
|
||||
encode = 'GBK'
|
||||
|
||||
|
||||
def enqueue_output(out, queue):
|
||||
for line in iter(out.readline, b''):
|
||||
|
@ -42,8 +50,9 @@ while True:
|
|||
x.kill()
|
||||
else:
|
||||
try:
|
||||
logging.info(line.decode('utf8')[:-1])
|
||||
logging.info(line[:-1].decode(encode))
|
||||
except Exception:
|
||||
print(line)
|
||||
traceback.print_exc()
|
||||
|
||||
# break when all processes are done.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import asyncio
|
||||
import logging
|
||||
import os
|
||||
|
||||
from aiogram import types, executor
|
||||
|
@ -38,6 +39,7 @@ async def on_startup(dispatcher):
|
|||
gather_list.append(asyncio.ensure_future(Modules[x].function(FetchTarget)))
|
||||
await asyncio.gather(*gather_list)
|
||||
Scheduler.start()
|
||||
logging.getLogger('apscheduler.executors.default').setLevel(logging.WARNING)
|
||||
|
||||
|
||||
if dp:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import asyncio
|
||||
import logging
|
||||
import os
|
||||
|
||||
import discord
|
||||
|
@ -25,6 +26,7 @@ async def on_ready():
|
|||
gather_list.append(asyncio.ensure_future(Modules[x].function(FetchTarget)))
|
||||
await asyncio.gather(*gather_list)
|
||||
Scheduler.start()
|
||||
logging.getLogger('apscheduler.executors.default').setLevel(logging.WARNING)
|
||||
|
||||
|
||||
@client.event
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import asyncio
|
||||
import logging
|
||||
import os
|
||||
|
||||
from graia.application.event.mirai import NewFriendRequestEvent, BotInvitedJoinGroupRequestEvent
|
||||
|
@ -54,6 +55,7 @@ async def autorun_handler():
|
|||
gather_list.append(asyncio.ensure_future(Modules[x].function(FetchTarget)))
|
||||
await asyncio.gather(*gather_list)
|
||||
Scheduler.start()
|
||||
logging.getLogger('apscheduler.executors.default').setLevel(logging.WARNING)
|
||||
|
||||
|
||||
if Config('qq_host') and Config('qq_account'):
|
||||
|
|
|
@ -28,7 +28,7 @@ class Logginglogger(AbstractLogger):
|
|||
def __init__(self, fmt="[%(asctime)s][%(levelname)s]: %(msg)s", **kwargs):
|
||||
logging.basicConfig(
|
||||
format=fmt,
|
||||
level=logging.INFO if not kwargs.get("debug") else logging.DEBUG,
|
||||
level=logging.INFO if not kwargs.get("debug") else logging.DEBUG
|
||||
)
|
||||
|
||||
def info(self, msg):
|
||||
|
|
Reference in a new issue