-
Notifications
You must be signed in to change notification settings - Fork 4
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
Showing
54 changed files
with
932 additions
and
629 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 |
---|---|---|
|
@@ -3,34 +3,33 @@ | |
* @Blog: https://hotaru.icu | ||
* @Date: 2023-09-29 14:31:09 | ||
* @LastEditors: Hotaru [email protected] | ||
* @LastEditTime: 2024-07-27 14:45:43 | ||
* @LastEditTime: 2024-07-30 19:49:25 | ||
*/ | ||
import { Adapter, type AdapterConfig, type Context, MessageScope, Tsu } from 'kotori-bot' | ||
import CmdApi from './api' | ||
import CmdElements from './elements' | ||
|
||
export const config = Tsu.Object({ | ||
nickname: Tsu.String().default('Kotarou'), | ||
age: Tsu.Number().min(0).default(18), | ||
sex: Tsu.Union(Tsu.Literal('male'), Tsu.Literal('female')), | ||
'self-nickname': Tsu.String().default('KotoriO'), | ||
'self-id': Tsu.String().default('720') | ||
}) | ||
|
||
type CmdConfig = Tsu.infer<typeof config> & AdapterConfig | ||
|
||
export class CmdAdapter extends Adapter<CmdApi, CmdConfig> { | ||
export class CmdAdapter extends Adapter<CmdApi, CmdConfig, CmdElements> { | ||
private messageId = '' | ||
|
||
public readonly platform = 'cmd' | ||
|
||
public readonly api: CmdApi | ||
|
||
public readonly elements = new CmdElements() | ||
public readonly elements: CmdElements | ||
|
||
public constructor(ctx: Context, config: CmdConfig, identity: string) { | ||
super(ctx, config, identity) | ||
this.api = new CmdApi(this) | ||
this.elements = new CmdElements(this) | ||
this.selfId = config['self-id'] | ||
process.stdin.on('data', (data) => this.handle(data)) | ||
} | ||
|
@@ -44,11 +43,10 @@ export class CmdAdapter extends Adapter<CmdApi, CmdConfig> { | |
type: MessageScope.PRIVATE, | ||
messageId: this.messageId, | ||
message, | ||
messageAlt: message, | ||
userId: this.config.master, | ||
sender: { | ||
nickname: this.config.nickname, | ||
sex: this.config.sex, | ||
age: this.config.age | ||
nickname: this.config.nickname | ||
}, | ||
time: Date.now() | ||
}) | ||
|
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 |
---|---|---|
|
@@ -3,13 +3,18 @@ | |
* @Blog: https://hotaru.icu | ||
* @Date: 2023-09-29 14:31:13 | ||
* @LastEditors: Hotaru [email protected] | ||
* @LastEditTime: 2023-12-02 16:21:22 | ||
* @LastEditTime: 2024-07-30 19:06:41 | ||
*/ | ||
import { Api, string, Message } from 'kotori-bot' | ||
import { Api, type Message } from 'kotori-bot' | ||
|
||
export class CmdApi extends Api { | ||
public sendPrivateMsg(message: Message, userId: string) { | ||
public getSupportedEvents(): ReturnType<Api['getSupportedEvents']> { | ||
return ['on_message'] | ||
} | ||
|
||
public async sendPrivateMsg(message: Message, userId: string) { | ||
this.adapter.send('send_private_msg', { user_id: userId, message }) | ||
return { messageId: '', time: 0 } | ||
} | ||
} | ||
|
||
|
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
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
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
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* @Blog: https://hotaru.icu | ||
* @Date: 2023-07-11 14:18:27 | ||
* @LastEditors: Hotaru [email protected] | ||
* @LastEditTime: 2024-07-29 19:34:45 | ||
* @LastEditTime: 2024-07-30 16:17:29 | ||
*/ | ||
|
||
import { UserAccess, CommandError, type Context, MessageScope, TsuError, type LocaleType, Symbols } from 'kotori-bot' | ||
|
@@ -197,7 +197,7 @@ export function main(ctx: Context) { | |
let modulesList = Array.from(ctx[Symbols.modules].values()) | ||
if (name) { | ||
modulesList = modulesList.filter(([{ pkg }]) => pkg.name.startsWith(name)) | ||
if (modulesList.length === 0) return ['core.msg.module.not_found', { name }] | ||
if (modulesList.length === 0) return session.format('core.msg.module.not_found', { name }) | ||
} | ||
return session.format('core.msg.module', { | ||
list: modulesList | ||
|
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
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
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
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
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 |
---|---|---|
@@ -1,19 +1,19 @@ | ||
{ | ||
"goodnight.msg.morning.male": "boy", | ||
"goodnight.msg.morning.female": "girl", | ||
"goodnight.msg.morning.already": "%at%You already got up today, didn't you? (╬ ̄皿 ̄)", | ||
"goodnight.msg.morning.morning": "%at%Good morning! You are the %count% %sex% to wake up today ( ̄▽ ̄)~*", | ||
"goodnight.msg.afternoon.afternoon": "%at%It's already afternoon! You are the %count% %sex% to wake up today~", | ||
"goodnight.msg.morning.early": "%at%Please get enough sleep, you shouldn't wake up before %hour%:00 (╬ ̄皿 ̄)=○", | ||
"goodnight.msg.morning.late": "%at%Waking up now is even worse than not waking up! You are the %count% %sex% to wake up today", | ||
"goodnight.msg.night.already": "%at%You already said good night, go to bed early~", | ||
"goodnight.msg.night.not": "%at%Don't sleep without waking up, just die in your sleep! (▼ヘ▼#)", | ||
"goodnight.msg.night.less": "%at%You just woke up not long ago and now you want to sleep, don't challenge my bottom line! (#`皿′)", | ||
"goodnight.msg.night.later": "%at%Wow it's really late now, your wake time today is %time%, you need to take responsibility for your own health, I really care about you (;′⌒`)", | ||
"goodnight.msg.night.late": "%at%Good night~ Don't stay up too late, your wake time today is %time% (*^▽^*)", | ||
"goodnight.msg.night.normal": "%at%Good night, your wake time today is %time% (*^▽^*)", | ||
"goodnight.msg.night.early": "%at%You're sleeping too early, your wake time today is %time% ψ(*`ー′)ψ", | ||
"goodnight.msg.night.hours": "hours", | ||
"goodnight.msg.night.minutes": "minutes", | ||
"goodnight.msg.night.seconds": "seconds" | ||
"goodnight.msg.morning.male": "boy", | ||
"goodnight.msg.morning.female": "girl", | ||
"goodnight.msg.morning.already": "{0}You already got up today, didn't you? (╬ ̄皿 ̄)", | ||
"goodnight.msg.morning.morning": "{0}Good morning! You are the {1} {2} to wake up today ( ̄▽ ̄)~*", | ||
"goodnight.msg.afternoon.afternoon": "{0}It's already afternoon! You are the {1} {2} to wake up today~", | ||
"goodnight.msg.morning.early": "{0}Please get enough sleep, you shouldn't wake up before {1}:00 (╬ ̄皿 ̄)=○", | ||
"goodnight.msg.morning.late": "{0}Waking up now is even worse than not waking up! You are the {1} {2} to wake up today", | ||
"goodnight.msg.night.already": "{0}You already said good night, go to bed early~", | ||
"goodnight.msg.night.not": "{0}Don't sleep without waking up, just die in your sleep! (▼ヘ▼#)", | ||
"goodnight.msg.night.less": "{0}You just woke up not long ago and now you want to sleep, don't challenge my bottom line! (#`皿′)", | ||
"goodnight.msg.night.later": "{0}Wow it's really late now, your wake time today is {1}, you need to take responsibility for your own health, I really care about you (;′⌒`)", | ||
"goodnight.msg.night.late": "{0}Good night~ Don't stay up too late, your wake time today is {1} (*^▽^*)", | ||
"goodnight.msg.night.normal": "{0}Good night, your wake time today is {1} (*^▽^*)", | ||
"goodnight.msg.night.early": "{0}You're sleeping too early, your wake time today is {1} ψ(*`ー′)ψ", | ||
"goodnight.msg.night.hours": "hours", | ||
"goodnight.msg.night.minutes": "minutes", | ||
"goodnight.msg.night.seconds": "seconds" | ||
} |
Oops, something went wrong.