@@ -16,8 +16,8 @@ import {
1616 TextInputStyle ,
1717} from "discord.js" ;
1818import { logger } from "@lib" ;
19- import { GuildWithLogs , updateGuildLogs } from "@repo/database" ;
20- import { trimString , getCurrentValue , getUpdatePayload } from "@utils" ;
19+ import { GuildWithLogs } from "@repo/database" ;
20+ import { trimString , getCurrentValue , updateConfig } from "@utils" ;
2121import { TFunction } from "i18next" ;
2222import { DbConfigKey } from "@constants" ;
2323export async function waitForMessageComponent (
@@ -98,8 +98,7 @@ export async function dynamicChannel(
9898 const newValue = messageComponent . values [ 0 ] || null ;
9999
100100 // 2. Update Database Safely
101- const payload = getUpdatePayload ( dbKey , newValue ) ;
102- await updateGuildLogs ( messageComponent . guildId , payload ) ;
101+ await updateConfig ( messageComponent . guildId , dbKey , newValue ) ;
103102
104103 // 3. Reply
105104 const responseKey = newValue ? "set" : "unset" ;
@@ -158,8 +157,7 @@ export async function dynamicMessage(
158157 }
159158 }
160159
161- const payload = getUpdatePayload ( dbKey , finalValue ) ;
162- await updateGuildLogs ( messageComponent . guildId , payload ) ;
160+ await updateConfig ( messageComponent . guildId , dbKey , finalValue ) ;
163161
164162 await messageComponent . editReply ( { content : t ( `${ dbKey } .set` ) , components : [ ] } ) ;
165163}
@@ -204,8 +202,7 @@ export async function dynamicRole(
204202
205203 if ( ! newValue ) {
206204 // Unset
207- const payload = getUpdatePayload ( dbKey , null ) ;
208- await updateGuildLogs ( messageComponent . guildId , payload ) ;
205+ await updateConfig ( messageComponent . guildId , dbKey , null ) ;
209206 await messageComponent . editReply ( { content : t ( `${ dbKey } .unset` ) , components : [ ] } ) ;
210207 } else {
211208 // Hierarchy Check
@@ -220,8 +217,7 @@ export async function dynamicRole(
220217 }
221218
222219 // Set
223- const payload = getUpdatePayload ( dbKey , newValue ) ;
224- await updateGuildLogs ( messageComponent . guildId , payload ) ;
220+ await updateConfig ( messageComponent . guildId , dbKey , newValue ) ;
225221
226222 await messageComponent . editReply ( {
227223 content : t ( `${ dbKey } .set` , {
0 commit comments