11import { ActionRowBuilder , ButtonBuilder , ButtonInteraction , ButtonStyle , ChannelType , EmbedBuilder , GuildMember , GuildMemberRoleManager , Interaction , Message , MessageFlags , ModalBuilder , PermissionsBitField , TextChannel , TextInputBuilder , TextInputStyle , User , UserSelectMenuBuilder , VoiceChannel } from "npm:discord.js"
22import { saveTranscript , findUser , lastLogin , getServerURLs , getLastDaily , addCoins , setLastDaily , getCoins , removeCoins , addPartner , removePartner , getPartners , getMemberFromBBNId } from "./db.ts" ;
3+ import { createTicketChannelID , firstLevelSupportCategoryID , getStartedChannelID , ownerRoleID , secondLevelSupportCategoryID , supportRole , supportRoles , verified } from "./const.ts" ;
34
45export async function handleInteraction ( interaction : Interaction ) {
56 if ( interaction . isButton ( ) ) {
@@ -86,7 +87,7 @@ export async function handleInteraction(interaction: Interaction) {
8687
8788 if ( interaction . isUserSelectMenu ( ) && interaction . guild && interaction . customId === 'verify_modal' ) {
8889 const member = interaction . guild . members . cache . get ( interaction . values [ 0 ] )
89- const role = interaction . guild . roles . cache . get ( "757983851032215673" )
90+ const role = interaction . guild . roles . cache . get ( verified )
9091
9192 if ( member && role ) {
9293 if ( member . roles . cache . has ( role . id ) ) {
@@ -147,7 +148,7 @@ export async function handleInteraction(interaction: Interaction) {
147148 "ViewChannel" : true
148149 } ) ;
149150 await possibleChannel . send ( {
150- content : `${ interaction . member } || <@&1120392307087261787 >` ,
151+ content : `${ interaction . member } || <@&${ supportRole } >` ,
151152 embeds : [ embed ] ,
152153 components : [ btnrow ] ,
153154 } ) ;
@@ -161,7 +162,7 @@ export async function handleInteraction(interaction: Interaction) {
161162 name : ticketname ,
162163 type : ChannelType . GuildText ,
163164 topic : `ticket of ${ interaction . user . tag } ` ,
164- parent : "1081347349462405221" ,
165+ parent : firstLevelSupportCategoryID ,
165166 } ) ;
166167
167168 setTimeout ( ( ) => {
@@ -171,7 +172,7 @@ export async function handleInteraction(interaction: Interaction) {
171172 } , 5000 ) ;
172173
173174 await ch . send ( {
174- content : `${ interaction . member } || <@&1120392307087261787 >` ,
175+ content : `${ interaction . member } || <@&${ supportRole } >` ,
175176 embeds : [ embed ] ,
176177 components : [ btnrow ] ,
177178 } ) ;
@@ -221,7 +222,7 @@ export async function handleInteraction(interaction: Interaction) {
221222 // interaction.reply("message sent!")
222223
223224 // code
224- const ticketChannel = interaction . guild ! . channels . cache . get ( "1081337337704886392" ) as TextChannel ;
225+ const ticketChannel = interaction . guild ! . channels . cache . get ( createTicketChannelID ) as TextChannel ;
225226 if ( ! ticketChannel ) return ;
226227
227228 const embed = new EmbedBuilder ( )
@@ -256,13 +257,13 @@ export async function handleInteraction(interaction: Interaction) {
256257 return ;
257258 }
258259 // move to escalation category
259- interaction . channel ?. setParent ( "1120395441138315345" , {
260+ interaction . channel ?. setParent ( secondLevelSupportCategoryID , {
260261 lockPermissions : false ,
261262 reason : "Ticket escalated" ,
262263 } ) ;
263264 interaction . reply ( {
264- allowedMentions : { roles : [ '757969277063266407' ] } ,
265- content : " Ticket escalated. || <@&757969277063266407>"
265+ allowedMentions : { roles : [ ownerRoleID ] } ,
266+ content : ` Ticket escalated. || <@&${ ownerRoleID } >`
266267 } ) ;
267268 }
268269
@@ -272,18 +273,18 @@ export async function handleInteraction(interaction: Interaction) {
272273 return ;
273274 }
274275 // check if ticket channel
275- if ( ! ( interaction . channel ?. type === ChannelType . GuildText && interaction . channel ?. parent ?. id === "1120395441138315345" ) ) {
276+ if ( ! ( interaction . channel ?. type === ChannelType . GuildText && interaction . channel ?. parent ?. id === secondLevelSupportCategoryID ) ) {
276277 interaction . reply ( "This command can only be used in a ticket channel." ) ;
277278 return ;
278279 }
279- // move to escalation category
280- interaction . channel ?. setParent ( "1081347349462405221" , {
280+ // move to first level category
281+ interaction . channel ?. setParent ( firstLevelSupportCategoryID , {
281282 lockPermissions : false ,
282283 reason : "Ticket deescalated" ,
283284 } ) ;
284285 interaction . reply ( {
285- allowedMentions : { roles : [ '1120392307087261787' ] } ,
286- content : " Ticket deescalated. || <@&1120392307087261787>"
286+ allowedMentions : { roles : [ supportRole ] } ,
287+ content : ` Ticket deescalated. || <@&${ supportRole } >`
287288 } ) ;
288289 }
289290
@@ -306,7 +307,7 @@ export async function handleInteraction(interaction: Interaction) {
306307 }
307308
308309 let reward = 10 + ( Math . floor ( Math . random ( ) * 10 ) ) ;
309- if ( ( await interaction . guild ! . members . fetch ( interaction . user . id ) ) . premiumSince || ( await interaction . guild ! . members . fetch ( interaction . user . id ) ) . roles . cache . has ( "1120392307087261787" ) )
310+ if ( ( await interaction . guild ! . members . fetch ( interaction . user . id ) ) . premiumSince || ( await interaction . guild ! . members . fetch ( interaction . user . id ) ) . roles . cache . has ( supportRole ) )
310311 reward *= 10 ;
311312 const res = await addCoins ( interaction . user . id , reward ) ;
312313 if ( res === null ) {
@@ -384,7 +385,7 @@ export async function handleInteraction(interaction: Interaction) {
384385 const ram = interaction . options . getInteger ( "ram" , true ) ;
385386 const storage = interaction . options . getInteger ( "storage" , true ) ;
386387 const slots = interaction . options . getInteger ( "slots" , true ) ;
387- const invite = await interaction . guild ?. invites . create ( Deno . env . get ( "GETSTARTED_CHANNEL" ) ! , {
388+ const invite = await interaction . guild ?. invites . create ( getStartedChannelID , {
388389 maxAge : 0 ,
389390 unique : true ,
390391 reason : "Partner invite" ,
@@ -515,8 +516,6 @@ async function fetchSteamnames(web_token: string | null, owners: { sum: Record<s
515516 return owners ;
516517}
517518
518- const supportRoles = [ "757969277063266407" , "815298088184446987" , "1120392307087261787" ] // Owner, Dev, Support
519-
520519function lockVoice ( interaction : ButtonInteraction , lock : boolean ) {
521520 const channel = ( interaction . member as GuildMember ) . voice . channel as VoiceChannel
522521
0 commit comments