feat: presence

This commit is contained in:
2025-09-30 21:29:52 +02:00
parent cdff397645
commit a49e1c7679
2 changed files with 35 additions and 1 deletions

View File

@@ -34,7 +34,6 @@
# Context Menu Commands
- [x] bonzify - Text-to-speech with Bonzi Buddy voice
- [x] cursivify - Italicize message text
- [ ] quote - Generate a quote image from a message
- [x] image-classification - Cloudflare AI image classification
# Message driven functions

35
src/presence.ts Normal file
View File

@@ -0,0 +1,35 @@
import { Presence } from '@sern/handler'
import { ActivityType, ClientPresenceStatus } from 'discord.js';
function shuffleArray(array: any[]) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
return [...array];
}
const statuses: Statuses = [
[ActivityType.Playing, "Minecraft", "online"],
[ActivityType.Watching, "cómo escribe Javi", "online"],
[ActivityType.Playing, "séptimo libro", "online"],
[ActivityType.Watching, "a Hermes", "online"],
[ActivityType.Listening, "tus comandos", "online"],
[ActivityType.Playing, "ahora v2!", "online"],
];
type Statuses = [ActivityType, string, ClientPresenceStatus][];
export default Presence.module({
execute: () => {
const [type, name, status] = statuses.at(0)!;
return Presence
.of({ activities: [ { type, name } ], status })
.repeated(() => {
const [type, name, status] = [...shuffleArray(statuses)].shift()!;
return {
status,
activities: [{ type, name }]
};
}, 60_000);
}
})