mirror of
https://github.com/PaiGramTeam/MibooGram.git
synced 2025-02-08 02:59:22 +00:00
🎨 对上传的文件限制为 256kb
This commit is contained in:
parent
aea5e41d7b
commit
dc30f33dd1
@ -1,8 +1,7 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from genshin.models import BannerType
|
|
||||||
|
|
||||||
|
from genshin.models import BannerType
|
||||||
from telegram import Update, User, Message, Document
|
from telegram import Update, User, Message, Document
|
||||||
from telegram.constants import ChatAction
|
from telegram.constants import ChatAction
|
||||||
from telegram.ext import CallbackContext, CommandHandler, MessageHandler, filters, ConversationHandler
|
from telegram.ext import CallbackContext, CommandHandler, MessageHandler, filters, ConversationHandler
|
||||||
@ -68,8 +67,8 @@ class GachaLog(Plugin.Conversation, BasePlugin.Conversation):
|
|||||||
document = message.document
|
document = message.document
|
||||||
if not document.file_name.endswith(".json"):
|
if not document.file_name.endswith(".json"):
|
||||||
await message.reply_text("文件格式错误,请发送符合 UIGF 标准的抽卡记录文件")
|
await message.reply_text("文件格式错误,请发送符合 UIGF 标准的抽卡记录文件")
|
||||||
if document.file_size > 50 * 1024 * 1024:
|
if document.file_size > 0.2 * 1024 * 1024:
|
||||||
await message.reply_text("文件过大,请发送小于 50MB 的文件")
|
await message.reply_text("文件过大,请发送小于 256kb 的文件")
|
||||||
try:
|
try:
|
||||||
data = BytesIO()
|
data = BytesIO()
|
||||||
await (await document.get_file()).download(out=data)
|
await (await document.get_file()).download(out=data)
|
||||||
|
Loading…
Reference in New Issue
Block a user