package Ġme . ab err ant fox . hot bot . database Ċ Ċ import Ġme . ab err ant fox . hot bot . utility . Mute Record Ċ import Ġorg . jetbrains . ex posed . sql .* Ċ import Ġorg . jetbrains . ex posed . sql . transactions . transaction ĊĊ Ċ fun Ġinsert Mut ed Member ( record : ĠM ute Record ) Ġ= ĊĠĠĠ Ġtransaction Ġ{ ĊĠĠĠĠĠĠĠ ĠM uted Member . insert Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġit [ Mut ed Member . un mute Time ] Ġ= Ġrecord . un mute Time ĊĠĠĠĠĠĠĠĠĠĠĠ Ġit [ Mut ed Member . reason ] Ġ= Ġrecord . reason ĊĠĠĠĠĠĠĠĠĠĠĠ Ġit [ Mut ed Member . mod erator ] Ġ= Ġrecord . mod erator ĊĠĠĠĠĠĠĠĠĠĠĠ Ġit [ Mut ed Member . member ] Ġ= Ġrecord . user ĊĠĠĠĠĠĠĠĠĠĠĠ Ġit [ Mut ed Member . guild Id ] Ġ= Ġrecord . guild Id ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ Ċ fun Ġdelete Mut ed Member ( record : ĠM ute Record ) Ġ= ĊĠĠĠ Ġtransaction Ġ{ ĊĠĠĠĠĠĠĠ ĠM uted Member . delete Where Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠOp . build Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ( Mut ed Member . member Ġeq Ġrecord . user ) Ġand Ġ( Mut ed Member . guild Id Ġeq Ġrecord . guild Id ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ Ċ fun Ġdelete Mut ed Member ( userId : ĠString , Ġguild Id : String ) Ġ= ĊĠĠĠĠĠĠĠ Ġtransaction Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠM uted Member . delete Where Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠOp . build Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ( Mut ed Member . member Ġeq ĠuserId ) Ġand Ġ( Mut ed Member . guild Id Ġeq Ġguild Id ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} Ċ Ċ fun ĠgetAll Mut ed Members () Ġ= ĊĠĠĠ Ġtransaction Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġmut ed Members Ġ= Ġmutable ListOf < Mute Record >() ĊĠĠĠĠĠĠĠ Ġval Ġmembers In Db Ġ= ĠM uted Member . selectAll () ĊĊĠĠĠĠĠĠĠ Ġmembers In Db . forEach Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmut ed Members . add ( Mute Record ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġit [ Mut ed Member . un mute Time ], ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġit [ Mut ed Member . reason ], ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġit [ Mut ed Member . mod erator ], ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġit [ Mut ed Member . member ], ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġit [ Mut ed Member . guild Id ] ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ)) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġmut ed Members ĊĠĠĠ Ġ} Ċ Ċ fun Ġis Member Mut ed ( user : ĠString , Ġguild Id : ĠString ) Ġ= ĊĠĠĠĠĠĠĠ Ġtransaction Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠM uted Member . select Ġ{( Mut ed Member . member Ġeq Ġuser ) Ġand Ġ( Mut ed Member . guild Id Ġeq Ġguild Id ) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. count () Ġ> Ġ 0 ĊĠĠĠĠĠĠĠ Ġ}