Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ~tripsit so that it only works in Tripsitting channels. #804

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/discord/utils/messageCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
Role,
PermissionResolvable,
EmbedBuilder,
TextChannel,
} from 'discord.js';
import { stripIndents } from 'common-tags';
import { sleep } from '../commands/guild/d.bottest';
Expand All @@ -19,6 +20,14 @@ const helpCounter = new Map<string, number>();

export default messageCommand;

const tripsitChannels = [
env.CHANNEL_TRIPSIT,
env.CHANNEL_OPENTRIPSIT1,
env.CHANNEL_OPENTRIPSIT2,
env.CHANNEL_WEBTRIPSIT1,
env.CHANNEL_WEBTRIPSIT2,
];

const sadStuff = [
'sadface',
':(',
Expand Down Expand Up @@ -160,6 +169,15 @@ export async function messageCommand(message: Message): Promise<void> {
const command = message.content.split(' ')[0].slice(1);
// log.debug(F, `command: ${command}`);
if (command === 'tripsit') {
// If not in a tripsit channel and not in a specific users custom tripsit channel, tell them where to go and return.
if (!tripsitChannels.includes(message.channel.id) && !(message.channel as TextChannel).name.endsWith(`${message.author.displayName}'s channel!`)) {
const channelTripsit = await message.guild.channels.fetch(env.CHANNEL_TRIPSIT) as TextChannel;
const channelOpenTripsit1 = await message.guild.channels.fetch(env.CHANNEL_OPENTRIPSIT1) as TextChannel;
await message.channel.send(
stripIndents`Hey ${displayName}, this command is reserved for the tripsitting channels. Head on over to ${channelTripsit} or ${channelOpenTripsit1} and try again if you need help! <3`,
);
return;
}
const now = Date.now().valueOf();
if (helpCounter.has(message.author.id)) {
const lastTime = helpCounter.get(message.author.id);
Expand Down
Loading