|
@@ -2,9 +2,12 @@ import asyncio
|
|
import datetime
|
|
import datetime
|
|
|
|
|
|
from anon import Bot
|
|
from anon import Bot
|
|
-from anon.event.event import Event
|
|
|
|
from anon.plugin import PluginManager, Plugin
|
|
from anon.plugin import PluginManager, Plugin
|
|
from anon.event import MessageEvent
|
|
from anon.event import MessageEvent
|
|
|
|
+from anon.event.message import GroupMessage
|
|
|
|
+
|
|
|
|
+# (group, times)
|
|
|
|
+repeater = {}
|
|
|
|
|
|
|
|
|
|
class AnonPlugin(Plugin):
|
|
class AnonPlugin(Plugin):
|
|
@@ -15,5 +18,21 @@ class AnonPlugin(Plugin):
|
|
if event.raw == 'anon':
|
|
if event.raw == 'anon':
|
|
await event.reply('は?')
|
|
await event.reply('は?')
|
|
|
|
|
|
|
|
+ # repeater
|
|
|
|
+ if isinstance(event, GroupMessage):
|
|
|
|
+ group_id = event.gid
|
|
|
|
+ if group_id not in repeater:
|
|
|
|
+ repeater[group_id] = [event.raw, 1]
|
|
|
|
+ else:
|
|
|
|
+ if repeater[group_id][0] == event.raw:
|
|
|
|
+ repeater[group_id][1] += 1
|
|
|
|
+ if repeater[group_id][1] == 3:
|
|
|
|
+ await event.reply(event.raw, quote=False)
|
|
|
|
+ else:
|
|
|
|
+ repeater[group_id] = [event.raw, 1]
|
|
|
|
+
|
|
|
|
+ async def on_shutdown(self):
|
|
|
|
+ await Bot().send_private_message(782981223, f'Anon shutdown at: {datetime.datetime.now()}')
|
|
|
|
+
|
|
|
|
|
|
PluginManager().register_plugin(AnonPlugin([MessageEvent]))
|
|
PluginManager().register_plugin(AnonPlugin([MessageEvent]))
|