mirror of
https://github.com/SrIzan10/vinci.git
synced 2026-06-06 01:07:00 +00:00
feat: presence
This commit is contained in:
1
TODO.md
1
TODO.md
@@ -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
35
src/presence.ts
Normal 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);
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user