Skip to content
This repository was archived by the owner on Oct 9, 2025. It is now read-only.

Commit 842f4ed

Browse files
authored
Merge pull request #218 from Discord-InterChat/d-branch-1
feat: simplified onboarding process
2 parents 96445c0 + d911e31 commit 842f4ed

File tree

2 files changed

+45
-82
lines changed

2 files changed

+45
-82
lines changed

src/commands/slash/Main/setup.ts

Lines changed: 44 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import BaseCommand from '#main/core/BaseCommand.js';
22
import { RegisterInteractionHandler } from '#main/decorators/RegisterInteractionHandler.js';
3-
import { Pagination } from '#main/modules/Pagination.js';
43
import { HubJoinService } from '#main/services/HubJoinService.js';
5-
import Constants from '#main/utils/Constants.js';
4+
import Constants, { emojis } from '#main/utils/Constants.js';
65
import { CustomID } from '#main/utils/CustomID.js';
76
import { InfoEmbed } from '#main/utils/EmbedUtils.js';
87
import { stripIndents } from 'common-tags';
@@ -14,64 +13,40 @@ import {
1413
ButtonStyle,
1514
ChannelType,
1615
ChatInputCommandInteraction,
16+
InteractionContextType,
1717
RESTPostAPIChatInputApplicationCommandsJSONBody,
1818
} from 'discord.js';
1919

2020
export default class SetupCommand extends BaseCommand {
2121
readonly data: RESTPostAPIChatInputApplicationCommandsJSONBody = {
2222
name: 'setup',
2323
description: 'Setup the bot for the server',
24+
contexts: [InteractionContextType.Guild],
2425
options: [
2526
{
26-
name: 'interchat',
27+
name: 'channel',
2728
description: 'The channel to setup the bot in',
28-
type: ApplicationCommandOptionType.Subcommand,
29-
options: [
30-
{
31-
name: 'channel',
32-
description: 'The channel to setup the bot in',
33-
type: ApplicationCommandOptionType.Channel,
34-
channel_types: [
35-
ChannelType.GuildText,
36-
ChannelType.PublicThread,
37-
ChannelType.PrivateThread,
38-
],
39-
required: true,
40-
},
41-
],
42-
},
43-
{
44-
name: 'lobby',
45-
description: 'Learn how to use our userphone-like lobby chat system.',
46-
type: ApplicationCommandOptionType.Subcommand,
29+
type: ApplicationCommandOptionType.Channel,
30+
channel_types: [ChannelType.GuildText, ChannelType.PublicThread, ChannelType.PrivateThread],
31+
required: true,
4732
},
4833
],
4934
};
5035

5136
public async execute(interaction: ChatInputCommandInteraction) {
52-
const subcommand = interaction.options.getSubcommand(true);
53-
if (subcommand === 'lobby') await this.setupLobby(interaction);
54-
else if (subcommand === 'interchat') await this.setupHub(interaction);
55-
}
56-
57-
private async setupLobby(interaction: ChatInputCommandInteraction): Promise<void> {
58-
const embed = new InfoEmbed().setTitle('Lobby Setup').setDescription(stripIndents`
59-
The lobby is a userphone-like chat system where you can chat with random people. What makes it different from other userphone bots is that you can have upto 3 servers in a lobby at once.
60-
### How to setup:
61-
1. Type \`c!connect\` or \`c!call\`.
62-
2. Wait for someone to to join.
63-
3. Have fun! 🎉
64-
### Want something more?
65-
Try out our multi-server hub chatting using </setup interchat:1305504885315207259>
66-
67-
-# Note: You are expected to follow our [guidelines](${Constants.Links.Website}/guidelines). If you are found breaking the guidelines, you will be banned from using the bot.
68-
`);
69-
70-
await interaction.reply({ embeds: [embed] });
71-
}
72-
73-
private async setupHub(interaction: ChatInputCommandInteraction): Promise<void> {
74-
if (!interaction.inCachedGuild()) return;
37+
const embed = new InfoEmbed().setDescription(
38+
stripIndents`
39+
## ${emojis.guide_icon} Interchat Setup - Let\'s get started!
40+
Let's get started with setting up a connection to a hub from a channel in this server.
41+
### Hub?
42+
A **hub** is a **group**—where servers connect to, to chat together. Once you setup the bot in a channel, messages to and from that channel will go to other servers in that hub.
43+
## Choose a Hub
44+
1. Click **Official Hub** to join the official InterChat hub. (Recommended)
45+
2. Or click **Random Hub** to join to a random community hub!
46+
47+
You and this server are expected to follow the [guidelines](${Constants.Links.Website}/guidelines) when chatting. We hope you enjoy your time on InterChat. 🎉
48+
`,
49+
);
7550

7651
const channel = interaction.options.getChannel('channel', true, [
7752
ChannelType.GuildText,
@@ -95,40 +70,7 @@ export default class SetupCommand extends BaseCommand {
9570
),
9671
];
9772

98-
const embed1 = new InfoEmbed().setTitle('Interchat Setup - Let\'s get started!').setDescription(
99-
stripIndents`
100-
A **hub** is a group of servers that you can chat with. It can contain unlimited servers and lets you chat without disconnecting.
101-
102-
After this setup, you will be able to talk with people that are part of your chosen hub from ${channel}.
103-
`,
104-
);
105-
const setupEmbed = new InfoEmbed().setDescription(stripIndents`
106-
### Setup:
107-
1. Click **Official Hub** to connect to a hub moderated by InterChat staff.
108-
2. Or click **Random Hub** to connect to a random community owned hub.
109-
110-
You are expected to follow the [guidelines](${Constants.Links.Website}/guidelines) when chatting. If you are found breaking the guidelines, you will be banned from using the bot. Have fun! 🎉
111-
`);
112-
113-
const finalEmbed = new InfoEmbed().setDescription(stripIndents`
114-
### Finally:
115-
- Search for community hubs by category here: ${Constants.Links.Website}/hubs
116-
- Create your own hub using \`/hub create\`.
117-
- Join a hub by name or invite by using \`/hub join\`.
118-
- Leave a hub using \`/hub leave\`.
119-
- Use our userphone-like lobby chat using \`/setup lobby\`.
120-
121-
Thats it! We hope you enjoy your time on InterChat.
122-
-# Need help? Join our [support server](${Constants.Links.SupportInvite}).
123-
`);
124-
125-
await new Pagination({ hideButtons: { search: true, exit: true, select: true } })
126-
.addPages([
127-
{ embeds: [embed1] },
128-
{ embeds: [setupEmbed], components },
129-
{ embeds: [finalEmbed], components: [] },
130-
])
131-
.run(interaction);
73+
await interaction.reply({ embeds: [embed], components });
13274
}
13375

13476
@RegisterInteractionHandler('setupHub')
@@ -159,12 +101,33 @@ export default class SetupCommand extends BaseCommand {
159101
return;
160102
}
161103

104+
let joinSuccess = false;
105+
162106
if (customId.suffix === 'official') {
163107
// NOTE: if hub name ever changes, this will need to be updated
164-
await hubJoinService.joinHub(channel, 'InterChat Central');
108+
joinSuccess = await hubJoinService.joinHub(channel, 'InterChat Central');
165109
}
166110
else if (customId.suffix === 'random') {
167-
await hubJoinService.joinRandomHub(channel);
111+
joinSuccess = await hubJoinService.joinRandomHub(channel);
168112
}
113+
114+
if (!joinSuccess) return;
115+
116+
const embed1 = new InfoEmbed().setDescription(stripIndents`
117+
## ${emojis.yes} Setup Complete!
118+
The bot has been setup in ${channel.toString()}. You can now chat with other servers from this channel. 🎉
119+
`);
120+
121+
const embed2 = new InfoEmbed().setDescription(stripIndents`
122+
You can also setup the bot in other channels with a different hub using \`/hub join\`. Pick a hub of your own choosing from a wide list of [public hubs](${Constants.Links.Website}/hubs) made by the community.
123+
`);
124+
125+
const finalEmbed = new InfoEmbed().setDescription(stripIndents`
126+
If you have any questions or need help, feel free to ask in the [support server](${Constants.Links.SupportInvite}). We also have a [Documentation](${Constants.Links.Website}/docs) page for more information.
127+
128+
Enjoy your time on InterChat! 🎉
129+
`);
130+
131+
await interaction.followUp({ embeds: [embed1, embed2, finalEmbed], ephemeral: true });
169132
}
170133
}

src/utils/CustomID.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class CustomID {
2222
* @param suffix - The suffix for the custom ID (optional).
2323
* @returns CustomID - The CustomID instance for method chaining.
2424
*/
25-
setIdentifier(prefix: string, suffix?: string): CustomID {
25+
setIdentifier(prefix: string, suffix?: string): this {
2626
this.customId = `${prefix}${suffix ? `:${suffix}` : ''}`;
2727
return this;
2828
}

0 commit comments

Comments
 (0)