Skip to content

Commit

Permalink
Add debug logging for now
Browse files Browse the repository at this point in the history
  • Loading branch information
jirkavrba committed Oct 5, 2024
1 parent e0dfb85 commit 4f70f06
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions bot/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,28 @@ client.on("messageCreate", (event) => {
return;
}

const request = {
message_id: event.id.toString(),
user: {
id: event.author.id.toString(),
name: event.author.username,
avatar_url: event.author.avatarURL()
},
channel: {
id: event.channelId.toString(),
name: event.channel.name,
},
guild: {
id: event.guildId.toString(),
name: event.guild.name,
icon_url: event.guild.iconURL()
}
};

fetch(API_ENDPOINT, {
method: "POST",
credentials: "omit",
body: JSON.stringify({
message_id: event.id.toString(),
user: {
id: event.author.id.toString(),
name: event.author.username,
avatar_url: event.author.avatarURL()
},
channel: {
id: event.channelId.toString(),
name: event.channel.name,
},
guild: {
id: event.guildId.toString(),
name: event.guild.name,
icon_url: event.guild.iconURL()
}
}),
body: JSON.stringify(request),
headers: {
"Accept": "application/json",
"Content-Type": "application/json",
Expand All @@ -55,6 +57,8 @@ client.on("messageCreate", (event) => {
})
.then(response => response.json())
.then(async response => {
console.log({request, response});

if (!response.matches) {
return;
}
Expand Down

0 comments on commit 4f70f06

Please sign in to comment.