-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
db44def
commit f8474f6
Showing
2 changed files
with
30 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { karin, logger, segment, common } from 'node-karin' | ||
|
||
/** | ||
* 退群 | ||
*/ | ||
export const QuitGroup = karin.command(/^#?退群/, async (e) => { | ||
let groupId = e.msg.replace(/#?退群/g, "").trim() | ||
|
||
if (!groupId) return e.reply("群号不能为空") | ||
|
||
if (!/^\d+$/.test(groupId)) return e.reply("请输入正确的群号") | ||
const res = await e.bot.GetGroupInfo(groupId) | ||
if (!res) { | ||
await e.reply('\n你好像没加入这个群', { at: true }) | ||
return true | ||
} | ||
try { | ||
if (groupId == e.group_id) { | ||
await e.reply("3秒后退出本群聊") | ||
await common.sleep(3000) | ||
} | ||
await e.bot.LeaveGroup(groupId) | ||
e.reply(`已退出群聊『${groupId}』`) | ||
} catch (error) { | ||
await e.reply('\n错误: 未知原因❌', { at: true }) | ||
return true | ||
} | ||
return true | ||
}, { name: "退群", priority: "-1" }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters