chore: prettier

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2023-02-17 00:34:11 +01:00
parent 1fd04bf5d5
commit 21390fed8a
No known key found for this signature in database
GPG key ID: E13DFD4B47127951
3 changed files with 25 additions and 15 deletions

View file

@ -28,21 +28,19 @@ export async function expandDiscordLink(message: Message): Promise<void> {
let n = 0;
for (const r of results) {
if (n >= 3)
break; // only process three previews
if (n >= 3) break; // only process three previews
if (r.groups == undefined || r.groups.server_id != message.guildId)
continue; // do not let the bot leak messages from one server to another
const channel = await message.guild?.channels.fetch(
r.groups.channel_id
);
const channel = await message.guild?.channels.fetch(r.groups.channel_id);
if (!channel || !channel.isTextBased())
continue;
if (!channel || !channel.isTextBased()) continue;
if (channel instanceof ThreadChannel) {
if (!channel.parent?.members?.some((user) => user.id == message.author.id))
if (
!channel.parent?.members?.some((user) => user.id == message.author.id)
)
continue; // do not reveal a message to a user who can't see it
} else {
if (!channel.members?.some((user) => user.id == message.author.id))
@ -59,7 +57,7 @@ export async function expandDiscordLink(message: Message): Promise<void> {
})
.setColor(Colors.Aqua)
.setTimestamp(messageToShow.createdTimestamp)
.setFooter({ text: `#${messageToShow.channel.name}`})
.setFooter({ text: `#${messageToShow.channel.name}` });
if (messageToShow.content) {
builder.setDescription(messageToShow.content);
}
@ -84,7 +82,11 @@ export async function expandDiscordLink(message: Message): Promise<void> {
.setURL(messageToShow.url)
);
await message.reply({ embeds: [builder], components: [row], allowedMentions: {repliedUser: false}});
await message.reply({
embeds: [builder],
components: [row],
allowedMentions: { repliedUser: false },
});
n++;
} catch (e) {
console.error(e);