[deploy] add rotating rich presence
All checks were successful
Deploy Discord Bot / deploy (push) Successful in 36s
All checks were successful
Deploy Discord Bot / deploy (push) Successful in 36s
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { Client } from 'discord.js';
|
import { ActivityType, Client } from 'discord.js';
|
||||||
import { EventHandler } from '../utils/types';
|
import { EventHandler } from '../utils/types';
|
||||||
import { logger } from '../utils/logger';
|
import { logger } from '../utils/logger';
|
||||||
import { env } from '../config/env';
|
import { env } from '../config/env';
|
||||||
@@ -11,7 +11,20 @@ const event: EventHandler = {
|
|||||||
async execute(client: Client) {
|
async execute(client: Client) {
|
||||||
try {
|
try {
|
||||||
logger.info(`Bot eingeloggt als ${client.user?.tag}`);
|
logger.info(`Bot eingeloggt als ${client.user?.tag}`);
|
||||||
client.user?.setPresence({ activities: [{ name: 'Papo | /help', type: 0 }], status: 'online' });
|
const website = env.publicBaseUrl || 'https://papo.gg';
|
||||||
|
const activities = [
|
||||||
|
{ name: 'Papo | /help', type: ActivityType.Playing },
|
||||||
|
{ name: `Dashboard: ${website}`, type: ActivityType.Watching },
|
||||||
|
{ name: `${client.guilds.cache.size} Guilds verwaltet`, type: ActivityType.Watching }
|
||||||
|
];
|
||||||
|
let idx = 0;
|
||||||
|
const applyPresence = () => {
|
||||||
|
const activity = activities[idx % activities.length];
|
||||||
|
client.user?.setPresence({ activities: [activity], status: 'online' });
|
||||||
|
idx += 1;
|
||||||
|
};
|
||||||
|
applyPresence();
|
||||||
|
setInterval(applyPresence, 60_000);
|
||||||
logger.info(`Ready on ${client.guilds.cache.size} Guilds`);
|
logger.info(`Ready on ${client.guilds.cache.size} Guilds`);
|
||||||
// force guild command registration so new commands wie /birthday sofort erscheinen
|
// force guild command registration so new commands wie /birthday sofort erscheinen
|
||||||
if (context.commandHandler) {
|
if (context.commandHandler) {
|
||||||
|
|||||||
Reference in New Issue
Block a user