New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

koishi-plugin-common

Package Overview
Dependencies
Maintainers
1
Versions
141
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koishi-plugin-common - npm Package Compare versions

Comparing version 1.0.0-alpha.7 to 1.0.0-alpha.8

8

dist/authorize.js

@@ -48,7 +48,3 @@ "use strict";

}
app.receiver.once('connected', async () => {
if (!app.selfId) {
const info = await app.sender.getLoginInfo();
app._registerSelfId(info.userId);
}
app.receiver.once('ready', async () => {
await Promise.all([

@@ -75,3 +71,3 @@ ...Object.keys(authorityMap).map(async (key) => {

}
ctx.receiver.on('group_increase', async ({ userId }) => {
ctx.receiver.on('group-increase', async ({ userId }) => {
const authority = config.member;

@@ -78,0 +74,0 @@ const user = await database.getUser(userId, authority);

@@ -55,5 +55,5 @@ "use strict";

newMeta.rawMessage = koishi_utils_1.CQCode.unescape(message);
await ctx.app.dispatchMeta(newMeta);
await ctx.app.server.dispatchMeta(newMeta);
});
}
exports.default = apply;

@@ -9,18 +9,2 @@ "use strict";

exports.registerRank = registerRank;
registerRank('talkativeness', {
names: ['发言', '聊天'],
options: { offset: 1 },
groupOnly: true,
title(meta, options) {
const key = koishi_utils_1.getDateNumber() - options.offset;
const date = new Date(key * 86400000).toLocaleDateString();
return `本群 ${date} 的发言排行为:`;
},
value(user, meta, options) {
const key = koishi_utils_1.getDateNumber() - options.offset;
return (user.talkativeness[key] || {})[meta.groupId] || 0;
},
fields: ['talkativeness'],
format: value => value + ' 条',
});
function apply(ctx, options) {

@@ -27,0 +11,0 @@ ctx.command('rank <type>', '显示排行', options)

@@ -34,3 +34,3 @@ "use strict";

ctx = ctx.intersect(ctx.app.groups);
ctx.receiver.on('send', ({ groupId, message }) => {
ctx.receiver.on('before-send', ({ groupId, message }) => {
const state = getState(groupId);

@@ -37,0 +37,0 @@ state.repeated = true;

@@ -5,3 +5,3 @@ "use strict";

function apply(ctx, message = defaultMessage) {
ctx.receiver.on('group_increase', async (meta) => {
ctx.receiver.on('group-increase', async (meta) => {
const group = await ctx.database.getGroup(meta.groupId, 0, ['assignee']);

@@ -8,0 +8,0 @@ if (group.assignee !== ctx.options.selfId || ctx.options.selfId === meta.userId)

{
"name": "koishi-plugin-common",
"description": "Common plugins for Koishi",
"version": "1.0.0-alpha.7",
"version": "1.0.0-alpha.8",
"main": "dist/index.js",

@@ -31,5 +31,5 @@ "typings": "dist/index.d.ts",

"dependencies": {
"koishi-core": "^1.0.0-alpha.7",
"koishi-core": "^1.0.0-alpha.8",
"koishi-utils": "^1.0.0-alpha.3"
}
}

@@ -62,8 +62,3 @@ import { UserData, Database, Context, GroupRole } from 'koishi-core'

app.receiver.once('connected', async () => {
if (!app.selfId) {
const info = await app.sender.getLoginInfo()
app._registerSelfId(info.userId)
}
app.receiver.once('ready', async () => {
await Promise.all([

@@ -90,3 +85,3 @@ ...Object.keys(authorityMap).map(async (key) => {

ctx.receiver.on('group_increase', async ({ userId }) => {
ctx.receiver.on('group-increase', async ({ userId }) => {
const authority = config.member

@@ -93,0 +88,0 @@ const user = await database.getUser(userId, authority)

@@ -52,4 +52,4 @@ import { Context, CommandConfig } from 'koishi-core'

newMeta.rawMessage = CQCode.unescape(message)
await ctx.app.dispatchMeta(newMeta)
await ctx.app.server.dispatchMeta(newMeta)
})
}
import { Meta, GroupMemberInfo, UserData, Context, UserField, CommandConfig } from 'koishi-core'
import { getDateNumber, simplify } from 'koishi-utils'
import { simplify } from 'koishi-utils'

@@ -22,19 +22,2 @@ export interface Rank {

registerRank('talkativeness', {
names: ['发言', '聊天'],
options: { offset: 1 },
groupOnly: true,
title (meta, options) {
const key = getDateNumber() - options.offset
const date = new Date(key * 86400000).toLocaleDateString()
return `本群 ${date} 的发言排行为:`
},
value (user, meta, options) {
const key = getDateNumber() - options.offset
return (user.talkativeness[key] || {})[meta.groupId] || 0
},
fields: ['talkativeness'],
format: value => value + ' 条',
})
export default function apply (ctx: Context, options: CommandConfig) {

@@ -41,0 +24,0 @@ ctx.command('rank <type>', '显示排行', options)

@@ -60,3 +60,3 @@ import { Context } from 'koishi-core'

ctx.receiver.on('send', ({ groupId, message }) => {
ctx.receiver.on('before-send', ({ groupId, message }) => {
const state = getState(groupId)

@@ -63,0 +63,0 @@ state.repeated = true

@@ -8,3 +8,3 @@ import { App, Meta } from 'koishi-core'

export default function apply (ctx: App, message: WelcomeMessage = defaultMessage) {
ctx.receiver.on('group_increase', async (meta) => {
ctx.receiver.on('group-increase', async (meta) => {
const group = await ctx.database.getGroup(meta.groupId, 0, ['assignee'])

@@ -11,0 +11,0 @@ if (group.assignee !== ctx.options.selfId || ctx.options.selfId === meta.userId) return

@@ -1,20 +0,18 @@

import { CLIENT_PORT, createServer, SERVER_URL, ServerSession } from 'koishi-test-utils'
import { App } from 'koishi-core/src'
import { createApp, createServer, ServerSession } from 'koishi-test-utils'
import { Server } from 'http'
import help from '../src/help'
const app = new App({
type: 'http',
port: CLIENT_PORT,
server: SERVER_URL,
})
let server: Server
const app = createApp()
const server = createServer()
jest.setTimeout(1000)
beforeAll(() => app.start())
beforeAll(() => {
server = createServer()
return app.start()
})
afterAll(() => {
app.stop()
server.close()
return app.stop()
})

@@ -30,3 +28,3 @@

const session = new ServerSession('private', 'friend', { selfId: 123, userId: 456 })
const session = new ServerSession('private', 'friend', { userId: 456 })

@@ -33,0 +31,0 @@ describe('help command', () => {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc