package Ġorg . dark j ag uar . dj bot discord . events čĊč Ċ import Ġorg . dark j ag uar . dj bot discord . config . DJ Bot Config č Ċ import Ġorg . dark j ag uar . dj bot discord . events . interfaces . Command Event č Ċ import Ġorg . dark j ag uar . dj bot discord . logging . logger č Ċ import Ġsx . blah . discord . api . events . Event Subscriber č Ċ import Ġsx . blah . discord . handle . impl . events . guild . channel . message . Message Received Event čĊč Ċ class ĠCommand Event Manager ( private Ġval Ġconfig : ĠD J Bot Config , Ġvar arg Ġevents : ĠCommand Event ) Ġ{ čĊĠĠĠ Ġprivate Ġval Ġevents Ġ= Ġevents . flatMap Ġ{ Ġcommand Event Ġ-> Ġcommand Event . commands . map Ġ{ Ġit Ġto Ġcommand Event } Ġ}. toMap () čĊčĊĠĠĠ Ġ@ Event Subscriber čĊĠĠĠ Ġfun Ġon Message Received Event ( event : ĠMessage Received Event ) Ġ{ čĊĠĠĠĠĠĠĠ Ġval Ġargs Ġ= Ġevent . message . content . split (" Ġ") čĊčĊĠĠĠĠĠĠĠ Ġif Ġ( args . isEmpty () Ġ|| Ġ! args [ 0 ]. startsWith ( config . command Prefix )) Ġreturn čĊčĊĠĠĠĠĠĠĠ Ġval Ġcommand Ġ= Ġargs [ 0 ]. substring ( 1 ). toLowerCase () čĊčĊĠĠĠĠĠĠĠ Ġevents [ command ]?. on Event ( event , Ġargs . sub List ( 1 , Ġargs . size )) čĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ?: Ġlogger . error Ġ{ Ġ" No Ġevent Ġmanager Ġfound Ġfor Ġcommands : Ġ$ command " Ġ} čĊĠĠĠ Ġ} č Ċ } čĊ