Remove discord.js dependency.

This commit is contained in:
Kurt Hutten
2022-01-23 12:55:57 +11:00
parent c9b12fc938
commit 00df8a5c6a
4 changed files with 9 additions and 78 deletions

View File

@@ -9,7 +9,6 @@
"axios": "^0.25.0",
"cloudinary": "^1.23.0",
"cors": "^2.8.5",
"discord.js": "^13.5.1",
"express": "^4.17.1",
"human-id": "^2.0.1",
"middy": "^0.36.0",

View File

@@ -1,5 +1,4 @@
import axios from 'axios'
import {Client, Intents, MessageAttachment} from "discord.js"
let inst = null;
if (!process.env.DISCORD_TOKEN || !process.env.DISCORD_CHANNEL_ID) {
@@ -18,10 +17,11 @@ export async function sendDiscordMessage(text: string, url?: string) {
} else {
const API_URL = `/channels/${process.env.DISCORD_CHANNEL_ID}/messages`;
if (url) {
console.log(`posting "${text}" to: ${url}`)
return inst.post(API_URL, { embeds: [{
title: text,
image: {
url: url,
url,
},
}] });
} else {