Skip to content

Commit

Permalink
fix/lint compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
tuturd committed Sep 21, 2024
1 parent a7a09ec commit 0c58144
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/utils/sendDiscordMessage.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import axios from 'axios';
import Order from '../models/order';
import log from '../utils/log';
import log from './log';
import PlaceAndDiscord from "../models/placeAndDiscord";

const sendOrderToDiscordApi = async (order: Order) => {
const token = process.env.DISCORD_API_PRIVATE_KEY;
log.info('Sending order to discord...');

const items = '- ' + order.orderItems
const items = `- ${ order.orderItems
.map(orderItem => orderItem.item.name)
.join('\n- ');
.join('\n- ')}`;

try {
const discordId: string | null = (await PlaceAndDiscord.findByPk(order.place))?.discordId;
Expand All @@ -31,7 +31,7 @@ const sendOrderToDiscordApi = async (order: Order) => {
const content = `Ta commande est prête, viens la chercher !\n\nDétail de la commande :\n${items}\n\nNuméro de commande : **${order.place}**`;
await axios.post(
`https://discord.com/api/channels/${dmId}/messages`,
{ content: content},
{ content },
{ headers: { Authorization: `Bot ${token}` } }
);
log.info(`Discord message sent to : ${discordId}`);
Expand Down

0 comments on commit 0c58144

Please sign in to comment.