@@ -9,8 +9,6 @@ import Command from '../Command';
99import Logger from '../utils/Logger' ;
1010import QR from './QR' ;
1111
12- const AS_ATTENDANCE_FORM_URL = 'https://docs.google.com/forms/d/e/1FAIpQLSc-akfqTNzrWUmOub_rMDj5wExBUDfakMXDbeGicOrpxBr6jg/viewform' ;
13-
1412/**
1513 * This Command DM's the caller the checkin code and Express Checkin link for any current and
1614 * upcoming events in today's timeframe. Optional argument `public` makes the embed with the
@@ -144,18 +142,19 @@ export default class Checkin extends Command {
144142
145143 // Now we finally check the command argument.
146144 // If we just had `checkin` in our call, no arguments...
145+ const asAttendanceForm = this . client . settings . asAttendanceForm ;
147146 if ( ! isPublic ) {
148147 const author = await this . client . users . fetch ( interaction . member ! . user . id ) ;
149148 // What we need now is to construct the Payload to send for `checkin`.
150- const privateMessage = await Checkin . getCheckinMessage ( todayEvents , isPublic , needsSlide , needsASForm ) ;
149+ const privateMessage = await Checkin . getCheckinMessage ( todayEvents , isPublic , needsSlide , needsASForm , asAttendanceForm ) ;
151150 await author . send ( privateMessage ) ;
152151 await super . edit ( interaction , {
153152 content : 'Check your DM.' ,
154153 ephemeral : true ,
155154 } ) ;
156155 await interaction . followUp ( `**/checkin** was used privately by ${ interaction . user } !` ) ;
157156 } else {
158- const publicMessage = await Checkin . getCheckinMessage ( todayEvents , isPublic , needsSlide , needsASForm ) ;
157+ const publicMessage = await Checkin . getCheckinMessage ( todayEvents , isPublic , needsSlide , needsASForm , asAttendanceForm ) ;
159158 await super . edit ( interaction , publicMessage ) ;
160159 }
161160 } catch ( e ) {
@@ -184,7 +183,7 @@ export default class Checkin extends Command {
184183 */
185184 private async getFutureEvents ( ) : Promise < PortalEvent [ ] > {
186185 try {
187- const portalAPIResponse = ( await got ( `${ this . client . settings . portalAPI . url } /event/future` , {
186+ const portalAPIResponse = ( await got ( `https://testing.api.acmucsd.com/api/v2 /event/future` , {
188187 headers : {
189188 'Content-Type' : 'application/json' ,
190189 Authorization : `Bearer ${ this . client . apiToken } ` ,
@@ -322,8 +321,7 @@ export default class Checkin extends Command {
322321
323322 // Get the Data URL of the image (base-64 encoded string of image).
324323 // Easier to attach than saving files.
325- const qrCodeDataUrl = await slide . toDataURL ( ) ;
326- return qrCodeDataUrl ;
324+ return await slide . toDataURL ( ) ;
327325 }
328326 // Only ACM portal checkin needed
329327 else {
@@ -402,7 +400,8 @@ export default class Checkin extends Command {
402400 events : PortalEvent [ ] ,
403401 isPublic : boolean ,
404402 needsSlide : boolean ,
405- needsASForm : boolean
403+ needsASForm : boolean ,
404+ asAttendanceForm : string ,
406405 ) : Promise < InteractionPayload > {
407406 // This method became very complicated very quickly, so we'll break this down.
408407 // Create arrays to store our payload contents temporarily. We'll put this in our embed
@@ -422,9 +421,7 @@ export default class Checkin extends Command {
422421 const expressCheckinURL = new URL ( 'https://members.acmucsd.com/checkin' ) ;
423422 expressCheckinURL . searchParams . set ( 'code' , event . attendanceCode ) ;
424423
425- const asFormFilledURL = new URL ( AS_ATTENDANCE_FORM_URL +
426- '?entry.219446721=Association+for+Computing+Machinery+(ACM)+-+' +
427- event . title . replace ( ' ' , '+' ) )
424+ const asFormFilledURL = new URL ( asAttendanceForm + event . title . replace ( ' ' , '+' ) )
428425 // +'&entry.570464428='+event.foodItems.replace(' ', '+') — for food items
429426
430427 // Add the Event's title and make it a hyperlink to the express check-in URL.
0 commit comments