import DFAdventureLogConfig from "./DFAdventureLogConfig" ; import DFAdventureLogProcessor from "./DFAdventureLogProcessor" ; interface AdventurLogApi { event ( message , postToChat ? ) : Promise < void > ; gmevent ( message , postToChat ? ) : Promise < void > ; quote ( speaker , message , postToChat ? ) : Promise < void > ; gmquote ( speaker , message , postToChat ? ) : Promise < void > ; } declare global { const AdventureLog ; } export function init ( ) { const api = { event : ( async function ( message , postToChat = false ) { DFAdventureLogProcessor . commandProcessor ( 'event ' + message , false , ! postToChat ) ; } ) . bind ( DFAdventureLogProcessor ) , gmevent : ( async function ( message , postToChat = false ) { if ( game . user . isGM ) DFAdventureLogProcessor . commandProcessor ( 'event ' + message , true , ! postToChat ) ; else ui . notifications . warn ( "DF_CHAT_LOG.Error.ApiLog_NotGm" . localize ( ) ) ; } ) . bind ( DFAdventureLogProcessor ) , quote : ( async function ( speaker , message , postToChat = false ) { DFAdventureLogProcessor . commandProcessor ( `quote "${ speaker }" ${ message }` , false , ! postToChat ) ; } ) . bind ( DFAdventureLogProcessor ) , gmquote : ( async function ( speaker , message , postToChat = false ) { if ( game . user . isGM ) DFAdventureLogProcessor . commandProcessor ( `quote "${ speaker }" ${ message }` , true , ! postToChat ) ; else ui . notifications . warn ( "DF_CHAT_LOG.Error.ApiLog_NotGm" . localize ( ) ) ; } ) . bind ( DFAdventureLogProcessor ) } ; window . AdventureLog = api ; } export function ready ( ) { if ( ! game . modules . get ( 'lib-wrapper' ) ?. active ) return ; DFAdventureLogConfig . setupSettings ( ) ; DFAdventureLogProcessor . setupSettings ( ) ; }