1
0
mirror of https://github.com/MrDetonia/Maki.git synced 2024-11-26 04:57:18 -05:00

Wrap stdout in default system encoding, v0.13.1

This commit is contained in:
Zac Herd 2016-04-29 10:20:42 +01:00
parent df230bcd8e
commit 516fe5e478

6
bot.py
View File

@ -9,6 +9,8 @@
import discord import discord
import asyncio import asyncio
import os import os
import io
import sys
import time import time
import datetime import datetime
import random import random
@ -27,7 +29,7 @@ from secret import token
name = "Maki" name = "Maki"
# bot version # bot version
version = "v0.13.0" version = "v0.13.1"
# text shown by .help command # text shown by .help command
helptext = """I am a bot written in Python by MrDetonia helptext = """I am a bot written in Python by MrDetonia
@ -347,6 +349,8 @@ def on_message(message):
else: else:
print('ERROR: Failed to send message to discord after 5 attempts') print('ERROR: Failed to send message to discord after 5 attempts')
# Setup stdout encoding
sys.stdout = io.TextIOWrapper(sys.stdout.detach(), encoding=sys.stdout.encoding, errors="backslashreplace", line_buffering=True)
# Run the client # Run the client
client.run(token) client.run(token)