feat: Clear resend queue command support
This commit is contained in:
parent
6a468f5bdd
commit
7c6b27d321
@ -15,3 +15,4 @@ import starbot.commands.builtin.help
|
|||||||
import starbot.commands.builtin.ranking.ranking
|
import starbot.commands.builtin.ranking.ranking
|
||||||
import starbot.commands.builtin.ranking.ranking_double
|
import starbot.commands.builtin.ranking.ranking_double
|
||||||
import starbot.commands.builtin.resend
|
import starbot.commands.builtin.resend
|
||||||
|
import starbot.commands.builtin.resend_clear_queue
|
||||||
|
37
starbot/commands/builtin/resend_clear_queue.py
Normal file
37
starbot/commands/builtin/resend_clear_queue.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
from graia.ariadne import Ariadne
|
||||||
|
from graia.ariadne.event.message import FriendMessage
|
||||||
|
from graia.ariadne.message.chain import MessageChain
|
||||||
|
from graia.ariadne.message.parser.twilight import Twilight, FullMatch, UnionMatch
|
||||||
|
from graia.ariadne.model import Friend
|
||||||
|
from graia.saya import Channel
|
||||||
|
from graia.saya.builtins.broadcast import ListenerSchema
|
||||||
|
|
||||||
|
from ...core.datasource import DataSource
|
||||||
|
from ...utils import config
|
||||||
|
|
||||||
|
prefix = config.get("COMMAND_PREFIX")
|
||||||
|
master = config.get("MASTER_QQ")
|
||||||
|
|
||||||
|
channel = Channel.current()
|
||||||
|
|
||||||
|
|
||||||
|
@channel.use(
|
||||||
|
ListenerSchema(
|
||||||
|
listening_events=[FriendMessage],
|
||||||
|
inline_dispatchers=[Twilight(
|
||||||
|
FullMatch(prefix),
|
||||||
|
UnionMatch("清空补发队列")
|
||||||
|
)],
|
||||||
|
)
|
||||||
|
)
|
||||||
|
async def resend_clear_queue(app: Ariadne, friend: Friend):
|
||||||
|
if friend.id != master:
|
||||||
|
return
|
||||||
|
|
||||||
|
if not config.get("BAN_RESEND"):
|
||||||
|
await app.send_friend_message(friend, MessageChain("补发功能未启用~"))
|
||||||
|
|
||||||
|
datasource: DataSource = app.options["StarBotDataSource"]
|
||||||
|
bot = datasource.get_bot(app.account)
|
||||||
|
bot.clear_resend_queue()
|
||||||
|
await app.send_friend_message(friend, MessageChain("补发队列已清空~"))
|
@ -66,6 +66,12 @@ class Bot(BaseModel):
|
|||||||
for up in self.ups:
|
for up in self.ups:
|
||||||
up.inject_bot(self)
|
up.inject_bot(self)
|
||||||
|
|
||||||
|
def clear_resend_queue(self):
|
||||||
|
"""
|
||||||
|
清空补发队列
|
||||||
|
"""
|
||||||
|
self.__queue.clear()
|
||||||
|
|
||||||
async def resend(self):
|
async def resend(self):
|
||||||
"""
|
"""
|
||||||
风控消息补发
|
风控消息补发
|
||||||
|
Loading…
x
Reference in New Issue
Block a user