Skip to content

Commit

Permalink
Merge branch 'main' into message-newline-fix-594
Browse files Browse the repository at this point in the history
  • Loading branch information
LunaUrsa authored Jul 3, 2024
2 parents 437ef7f + b66daa6 commit 950f2d3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
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
4 changes: 3 additions & 1 deletion src/discord/utils/techHelp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ export async function techHelpClick(interaction:ButtonInteraction) {
.setStyle(TextInputStyle.Paragraph)
.setPlaceholder(placeholder)
.setCustomId(`${issueType}IssueInput`)
.setRequired(true))));
.setRequired(true)
.setMinLength(10)
.setMaxLength(2000))));

const filter = (i:ModalSubmitInteraction) => i.customId.includes('techHelpSubmit');
interaction.awaitModalSubmit({ filter, time: 0 })
Expand Down

0 comments on commit 950f2d3

Please sign in to comment.