1- import { Discord , Description , On , ArgsOf } from "@typeit/discord" ;
1+ import { Discord , Description , On , ArgsOf , Client } from "@typeit/discord" ;
22import { Logger } from "./services/logger.service" ;
33import * as chalk from "chalk" ;
44import * as Path from "path" ;
@@ -23,14 +23,17 @@ export abstract class Starter {
2323 * When bot has logged in output bot is ready.
2424 */
2525 @On ( "ready" )
26- initialize ( ) : void {
26+ // eslint-disable-next-line no-empty-pattern
27+ initialize ( [ ] : ArgsOf < "ready" > , client : Client ) : void {
2728 this . logger . info ( "info check" ) ;
2829 this . logger . warn ( "warning check" ) ;
2930 this . logger . error ( "error check" ) ;
3031 this . logger . info ( chalk . bold ( "BOT READY" ) ) ;
3132 this . logger . info ( Path . join ( __dirname , "commands" , "*.ts" ) ) ;
3233 this . logger . info ( Path . join ( __dirname , "guild" , "*.ts" ) ) ;
3334 this . logger . info ( Path . join ( __dirname , "member" , "*.ts" ) ) ;
35+
36+ this . changeStatus ( client ) ;
3437 }
3538
3639 /**
@@ -43,8 +46,21 @@ export abstract class Starter {
4346 this . logger . error ( `${ chalk . bold ( "BOT ERROR" ) } : ${ error } ` ) ;
4447 }
4548
46- // @On ("raw")
47- // async onEvent(event: any): Promise<any> {
48-
49- // }
49+ changeStatus ( client : Client ) : void {
50+ let status = 3 ;
51+ const activities = [
52+ 'https://discord.js.org/' ,
53+ '?help' ,
54+ 'https://github.com/OwenCalvin/discord.ts' ,
55+ '' ,
56+ 'https://www.npmjs.com/package/@typeit/discord' ,
57+ '?docs' ,
58+ ] ;
59+ setInterval ( ( ) => {
60+ client . user . setActivity ( activities [ status ] ) ;
61+ this . logger . info ( `Set status to : ${ activities [ status ] } ` ) ;
62+ status = Math . floor ( Math . random ( ) * activities . length ) ;
63+ } , 60000 * 15 ) ;
64+ }
65+
5066}
0 commit comments