File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ const smClient = new SecretsManagerClient({
55
55
region : genericConfig . AwsRegion ,
56
56
} ) ;
57
57
58
- const getSecretValue = async (
58
+ export const getSecretValue = async (
59
59
secretId : string ,
60
60
) : Promise < Record < string , string | number | boolean > | null > => {
61
61
const data = await smClient . send (
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import {
10
10
} from "discord.js" ;
11
11
import { type EventPostRequest } from "./events.js" ;
12
12
import moment from "moment" ;
13
+ import { getSecretValue } from "../plugins/auth.js" ;
13
14
14
15
// https://stackoverflow.com/a/3809435/5684541
15
16
// https://calendar-buff.acmuiuc.pages.dev/calendar?id=dd7af73a-3df6-4e12-b228-0d2dac34fda7&date=2024-08-30
@@ -30,7 +31,8 @@ export const updateDiscord = async (
30
31
const client = new Client ( { intents : [ GatewayIntentBits . Guilds ] } ) ;
31
32
client . once ( Events . ClientReady , async ( readyClient : Client < true > ) => {
32
33
console . log ( `Logged in as ${ readyClient . user . tag } ` ) ;
33
- const guild = await client . guilds . fetch ( process . env . DISCORD_GUILD_ID || "" ) ;
34
+ const guildID = await getSecretValue ( "discord_guild_id" ) ;
35
+ const guild = await client . guilds . fetch ( guildID ?. toString ( ) || "" ) ;
34
36
const discordEvents = await guild . scheduledEvents . fetch ( ) ;
35
37
const snowflakeMeetingLookup = discordEvents . reduce (
36
38
( o , event ) => {
@@ -100,6 +102,6 @@ export const updateDiscord = async (
100
102
await client . destroy ( ) ;
101
103
} ) ;
102
104
103
- console . log ( "TOKEN" , process . env . DISCORD_BOT_TOKEN ) ;
104
- client . login ( process . env . DISCORD_BOT_TOKEN ) ;
105
+ const token = await getSecretValue ( "discord_bot_token" ) ;
106
+ client . login ( token ?. toString ( ) ) ;
105
107
} ;
You can’t perform that action at this time.
0 commit comments