Skip to content

Commit

Permalink
fix(help): Update docs links
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-737 committed Sep 27, 2023
1 parent c265720 commit 2d8feca
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 43 deletions.
42 changes: 21 additions & 21 deletions src/Commands/Information/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ export default {
### Guide
InterChat is a powerful discord bot that enables effortless cross-server chatting! Get started by looking at the categories below.
### Categories:
- ⚙️ [**Setting up InterChat**](https://discord-interchat.github.io/docs/guide/setup)
- ⚙️ [**Setting up InterChat**](https://discord-interchat.github.io/docs/setup)
- ${emojis.normal.slashCommand} [**All Commands**](https://discord-interchat.github.io/docs/category/commands)
- 🌐 [**The Network**](https://discord-interchat.github.io/docs/guide/hub/network)
- 💬 [**Messaging**](https://discord-interchat.github.io/docs/category/messaging)
- 👥 [**Hubs**](https://discord-interchat.github.io/docs/guide/hub/joining)
- 💬 [**Messaging & Network**](https://discord-interchat.github.io/docs/messaging)
- 👥 [**Hubs**](https://discord-interchat.github.io/docs/hub/joining)
`);

const selects = new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(
Expand Down Expand Up @@ -82,12 +81,13 @@ export default {
Think of hubs as your personal chat spaces, both creatable and joinable. They're like an exclusive room, where other servers can join to engage and chat together.
### Hub Guides
- ${emojis.icons.join} [**Join a Hub**](https://discord-interchat.github.io/docs/guide/hub/joining)
- ${emojis.icons.leave} [**Leave a Hub**](https://discord-interchat.github.io/docs/guide/hub/leaving)
- ✨ [**Create a Hub**](https://discord-interchat.github.io/docs/guide/hub/management#21-creating-a-hub)
- ${emojis.icons.delete} [**Delete a Hub**](https://discord-interchat.github.io/docs/guide/hub/management#21-creating-a-hub)
- 🛡️ [**Hub Moderators**](https://discord-interchat.github.io/docs/guide/hub/management#23-managing-hub-moderators)
- ${emojis.icons.settings} [**Hub Settings**](https://discord-interchat.github.io/docs/guide/hub/management#24-managing-hub-settings)
- ${emojis.icons.join} [**Join a Hub**](https://discord-interchat.github.io/docs/hub/joining)
- ${emojis.icons.leave} [**Leave a Hub**](https://discord-interchat.github.io/docs/hub/leaving)
- ✨ [**Create a Hub**](https://discord-interchat.github.io/docs/hub/management#creating-a-hub)
- ${emojis.icons.delete} [**Delete a Hub**](https://discord-interchat.github.io/docs/hub/management#deleting-a-hub)
- 🛡️ [**Hub Moderators (Adding, Removing)**](https://discord-interchat.github.io/docs/hub/management#managing-hub-moderators)
- 📝 [**Edit Hub**](https://discord-interchat.github.io/docs/hub/management#editing-your-hub)
- ${emojis.icons.settings} [**Hub Settings**](https://discord-interchat.github.io/docs/hub/management#hub-settings)
`,
);

Expand All @@ -100,9 +100,9 @@ export default {
## The Network
Network refers to the entire web of servers that are connected to a hub. In this area, you can send messages that will appear in other channels that have been set up on other servers.
### Network Guides
- 🌎 [**What is the network?**](https://discord-interchat.github.io/docs/guide/hub/network)
- ${emojis.icons.connect} [**Using the network**](https://discord-interchat.github.io/docs/guide/hub/network#using-the-network)
- ${emojis.icons.settings} [**Network Settings (Coming soon!)**](https://discord-interchat.github.io/docs/guide/hub/network#network-settings)
- 🌎 [**What is the network?** (Coming Soon!)](https://discord-interchat.github.io/docs/hub/network)
- ${emojis.icons.connect} [**Using the network**](https://discord-interchat.github.io/docs/messaging#sending-messages)
- ${emojis.icons.settings} [**Network Settings (Coming soon!)**](https://discord-interchat.github.io/docs/hub/network#network-settings)
`);

i.update({ embeds: [networkEmbed] });
Expand All @@ -115,13 +115,13 @@ export default {
## Messaging
Messaging refers to the ability to send messages to other servers within a hub. Find out how to send messages by visiting the guides below. You can also edit and delete messages that you have sent.
### Messaging Guides
- 📨 [ **Send Messages**](https://discord-interchat.github.io/docs/guide/message/sending-messages)
- ✏️ [ **Edit Messages**](https://discord-interchat.github.io/docs/guide/message/editing)
- ${emojis.icons.delete} [**Delete Messages**](https://discord-interchat.github.io/docs/guide/message/deleting)
- ${emojis.normal.reply} [**Reply to Messages**](https://discord-interchat.github.io/docs/guide/message/replying)
- 😂 [**React to Messages (Coming soon!)**](https://discord-interchat.github.io/docs/guide/message/reacting)
- ${emojis.icons.wand} [**The InterChat Team (Coming Soon!)**](https://discord-interchat.github.io/docs/important/credits)
- 📑 [**Report Messages**](https://discord-interchat.github.io/docs/guide/message/reporting)
- 📨 [**Send Messages**](https://discord-interchat.github.io/docs/messaging#sending-messages)
- ✏️ [**Edit Messages**](https://discord-interchat.github.io/docs/messaging#editing-messages)
- ${emojis.icons.delete} [**Delete Messages**](https://discord-interchat.github.io/docs/messaging#deleting-messages)
- ${emojis.normal.reply} [**Reply to Messages**](https://discord-interchat.github.io/docs/messaging#replying-to-messages)
- 😂 [**React to Messages (Coming soon!)**](https://discord-interchat.github.io/docs/message/reacting)
- ${emojis.icons.wand} [**The InterChat Team (Coming Soon!)**](https://discord-interchat.github.io/docs/credits)
- 📑 [**Report Messages**](https://discord-interchat.github.io/docs/messaging#reporting-messages--users)
`);

i.update({ embeds: [messagingEmbed] });
Expand Down Expand Up @@ -168,7 +168,7 @@ export default {
${normal.dotBlue} @${members[5]?.username}
${linksDivider}
[Guide](https://discord-interchat.github.io/docs) • [Invite](https://discord.com/application-directory/769921109209907241) • [Support Server](https://discord.gg/6bhXQynAPs) • [Vote](https://top.gg/bot/769921109209907241/vote) • [Privacy](https://discord-interchat.github.io/important/privacy) • [Terms](https://discord-interchat.github.io/important/terms)
[Guide](https://discord-interchat.github.io/docs) • [Invite](https://discord.com/application-directory/769921109209907241) • [Support Server](https://discord.gg/6bhXQynAPs) • [Vote](https://top.gg/bot/769921109209907241/vote) • [Privacy](https://discord-interchat.github.io/legal/privacy) • [Terms](https://discord-interchat.github.io/legal/terms)
`);

await i.editReply({ embeds: [creditsEmbed] });
Expand Down
6 changes: 3 additions & 3 deletions src/Events/guildCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ export default {
const buttons = new ActionRowBuilder<ButtonBuilder>().addComponents(
new ButtonBuilder()
.setLabel('Guide')
.setURL('https://discord-interchat.github.io/guide')
.setURL('https://discord-interchat.github.io/docs/setup')
.setStyle(ButtonStyle.Link),
new ButtonBuilder()
.setLabel('ToS')
.setURL('https://discord-interchat.github.io/important/terms')
.setURL('https://discord-interchat.github.io/docs/legal/terms')
.setStyle(ButtonStyle.Link),
new ButtonBuilder()
.setLabel('Privacy')
.setURL('https://discord-interchat.github.io/important/privacy')
.setURL('https://discord-interchat.github.io/docs/legal/privacy')
.setStyle(ButtonStyle.Link),
);

Expand Down
37 changes: 19 additions & 18 deletions src/Events/messageCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ export default {
if (message.author.bot || message.webhookId || message.system) return;

const db = getDb();
const channelInDb = await db.connectedList.findFirst({
const connection = await db.connectedList.findFirst({
where: { channelId: message.channel.id, connected: true },
include: { hub: { include: { connections: { where: { connected: true } } } } },
});

if (channelInDb && channelInDb?.hub) {
const settings = new HubSettingsBitField(channelInDb.hub?.settings);
if (!await checks.execute(message, channelInDb, settings)) return;
if (connection?.hub) {
const settings = new HubSettingsBitField(connection.hub?.settings);
if (!await checks.execute(message, connection, settings)) return;

message.censored_content = censor(message.content);
const attachment = message.attachments.first();
Expand Down Expand Up @@ -69,7 +69,7 @@ export default {
const embed = new EmbedBuilder()
.setDescription(message.content || null) // description must be null if message is only an attachment
.setImage(attachmentURL)
.setColor((channelInDb.embedColor as HexColorString) || 'Random')
.setColor((connection.embedColor as HexColorString) || 'Random')
.setFields(
referredContent
? [{ name: 'Reply to:', value: `> ${referredContent.replaceAll('\n', '\n> ')}` }]
Expand All @@ -84,13 +84,14 @@ export default {
text: `Server: ${message.guild?.name}`,
iconURL: message.guild?.iconURL() || undefined,
});
// define censored embed after reply is added to reflect that in censored embed as well

// profanity censored embed
const censoredEmbed = EmbedBuilder.from(embed).setDescription(message.censored_content || null);

// send the message to all connected channels in apropriate format (compact/profanity filter)
const messageResults = channelInDb.hub?.connections?.map(async (connection) => {
const reply = replyInDb?.channelAndMessageIds.find((msg) => msg.channelId === connection.channelId);
const replyLink = reply ? `https://discord.com/channels/${connection.serverId}/${reply.channelId}/${reply.messageId}` : undefined;
const messageResults = connection.hub?.connections?.map(async (connected) => {
const reply = replyInDb?.channelAndMessageIds.find((msg) => msg.channelId === connected.channelId);
const replyLink = reply ? `https://discord.com/channels/${connected.serverId}/${reply.channelId}/${reply.messageId}` : undefined;
const replyButton = replyLink && referredAuthor
? new ActionRowBuilder<ButtonBuilder>().addComponents(
new ButtonBuilder()
Expand All @@ -105,7 +106,7 @@ export default {
: null;

let webhookMessage: WebhookMessageCreateOptions;
if (connection.compact) {
if (connected.compact) {
const replyEmbed = replyLink && referredContent
? new EmbedBuilder()
.setColor('Random')
Expand All @@ -120,31 +121,31 @@ export default {
avatarURL: avatarURL,
username: displayNameOrUsername,
files: attachment ? [attachment] : undefined,
content: connection?.profFilter ? message.censored_content : message.content,
content: connected?.profFilter ? message.censored_content : message.content,
embeds: replyEmbed ? [replyEmbed] : undefined,
threadId: connection.parentId ? connection.channelId : undefined,
threadId: connected.parentId ? connected.channelId : undefined,
allowedMentions: { parse: [] },
};
}
else {
webhookMessage = {
components: replyButton ? [replyButton] : undefined,
embeds: [connection.profFilter ? censoredEmbed : embed],
embeds: [connected.profFilter ? censoredEmbed : embed],
files: attachment ? [attachment] : undefined,
username: `${channelInDb.hub?.name}`,
avatarURL: channelInDb.hub?.iconUrl,
threadId: connection.parentId ? connection.channelId : undefined,
username: `${connection.hub?.name}`,
avatarURL: connection.hub?.iconUrl,
threadId: connected.parentId ? connected.channelId : undefined,
allowedMentions: { parse: [] },
};
}

const webhook = new WebhookClient({ url: connection.webhookURL });
const webhook = new WebhookClient({ url: connected.webhookURL });
const webhookSendRes = await webhook.send(webhookMessage).catch((e) => e.message);
return { webhookURL: webhook.url, messageOrError: webhookSendRes } as NetworkWebhookSendResult;
});

message.delete().catch(() => null);
cleanup.execute(message, await Promise.all(messageResults), channelInDb.hubId);
cleanup.execute(message, await Promise.all(messageResults), connection.hubId);
}
},
};
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ export class ExtendedClient extends Client {
}
}

new ExtendedClient().start();
new ExtendedClient().start();

0 comments on commit 2d8feca

Please sign in to comment.