aboutsummaryrefslogtreecommitdiff
path: root/src/commands/config
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-08-25 14:47:07 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-08-25 14:47:07 -0400
commit0af0be5ab4ea0d972d9c406b28b81ee41a06cbdb (patch)
treecb5d6f06a115d7e9c3d38ea44995161f6c158082 /src/commands/config
parent76622cfcd13727949ef3a0baa30bf72007132cd2 (diff)
downloadtanzanite-0af0be5ab4ea0d972d9c406b28b81ee41a06cbdb.tar.gz
tanzanite-0af0be5ab4ea0d972d9c406b28b81ee41a06cbdb.tar.bz2
tanzanite-0af0be5ab4ea0d972d9c406b28b81ee41a06cbdb.zip
join roles, sticky roles, join messages, support threads etc
Diffstat (limited to 'src/commands/config')
-rw-r--r--src/commands/config/autoPublishChannel.ts3
-rw-r--r--src/commands/config/features.ts23
-rw-r--r--src/commands/config/joinRoles.ts54
3 files changed, 76 insertions, 4 deletions
diff --git a/src/commands/config/autoPublishChannel.ts b/src/commands/config/autoPublishChannel.ts
index f058402..10c4ab6 100644
--- a/src/commands/config/autoPublishChannel.ts
+++ b/src/commands/config/autoPublishChannel.ts
@@ -46,6 +46,9 @@ export default class AutoPublishChannelCommand extends BushCommand {
channel.id
);
await message.guild!.setSetting('autoPublishChannels', newValue);
+ client.logger.debugRaw(autoPublishChannels);
+ client.logger.debugRaw(channel.id);
+ client.logger.debugRaw(autoPublishChannels.includes(channel.id));
return await message.util.reply({
content: `${util.emojis.success} Successfully ${
autoPublishChannels.includes(channel.id) ? 'disabled' : 'enabled'
diff --git a/src/commands/config/features.ts b/src/commands/config/features.ts
index d37ce25..cb7f4bc 100644
--- a/src/commands/config/features.ts
+++ b/src/commands/config/features.ts
@@ -14,16 +14,31 @@
// slash: true,
// channel: 'guild',
// clientPermissions: ['SEND_MESSAGES', 'EMBED_LINKS'],
-// userPermissions: ['SEND_MESSAGES', 'MANAGE_GUILD']
+// userPermissions: ['SEND_MESSAGES', 'MANAGE_GUILD'],
+// ownerOnly: true
// });
// }
// public override async exec(message: BushMessage | BushSlashMessage): Promise<unknown> {
// if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be used in servers.`);
-// const featureEmbed = new MessageEmbed().setTitle(`${message.guild.name}'s Features`).setColor(util.colors.default);
+// const featureEmbed = await this.generateEmbed(message);
+// return await message.util.reply({ embeds: [featureEmbed] });
+// }
+
+// public async handleInteraction(): Promise<void> {
+
+// }
+
+// public async generateEmbed(message: BushMessage | BushSlashMessage): Promise<MessageEmbed> {
+// const featureEmbed = new MessageEmbed().setTitle(`${message.guild!.name}'s Features`).setColor(util.colors.default);
// const featureList: string[] = [];
-// const enabledFeatures = await message.guild.getSetting('enabledFeatures');
+// const enabledFeatures = await message.guild!.getSetting('enabledFeatures');
// guildFeatures.forEach((feature) => {
-// // featureList.push(`**${feature}:** ${enabledFeatures.includes(feature)? util.emojis.}`);
+// featureList.push(`**${feature}:** ${enabledFeatures.includes(feature) ? util.emojis.check : util.emojis.cross}`);
// });
+// return featureEmbed.setDescription(featureList.join('\n'));
+// }
+
+// public async generateButtons(): Promise<void>{
+
// }
// }
diff --git a/src/commands/config/joinRoles.ts b/src/commands/config/joinRoles.ts
new file mode 100644
index 0000000..ee2ce75
--- /dev/null
+++ b/src/commands/config/joinRoles.ts
@@ -0,0 +1,54 @@
+import { AllowedMentions, BushCommand, BushMessage, BushSlashMessage } from '@lib';
+import { Channel } from 'discord.js';
+
+export default class JoinRolesCommand extends BushCommand {
+ public constructor() {
+ super('joinRoles', {
+ aliases: ['joinroles', 'joinrole', 'jr'],
+ category: 'config',
+ description: {
+ content: 'Configure what roles to assign to someone when they join the server.',
+ usage: 'joinroles <role>',
+ examples: ['joinroles @member']
+ },
+ args: [
+ {
+ id: 'role',
+ type: 'role',
+ prompt: {
+ start: 'What role would you like me to assign to users when they join the server?',
+ retry: '{error} Choose a valid role',
+ optional: true
+ }
+ }
+ ],
+ slash: true,
+ slashOptions: [
+ {
+ name: 'role',
+ description: 'What role would you like me to assign to users when they join the server?',
+ type: 'ROLE',
+ required: false
+ }
+ ],
+ channel: 'guild',
+ clientPermissions: ['SEND_MESSAGES'],
+ userPermissions: ['SEND_MESSAGES', 'MANAGE_GUILD']
+ });
+ }
+ public override async exec(message: BushMessage | BushSlashMessage, { channel }: { channel: Channel }): Promise<unknown> {
+ const autoPublishChannels = await message.guild!.getSetting('joinRoles');
+ const newValue = util.addOrRemoveFromArray(
+ autoPublishChannels.includes(channel.id) ? 'remove' : 'add',
+ autoPublishChannels,
+ channel.id
+ );
+ await message.guild!.setSetting('joinRoles', newValue);
+ return await message.util.reply({
+ content: `${util.emojis.success} Successfully ${
+ autoPublishChannels.includes(channel.id) ? 'disabled' : 'enabled'
+ } auto publishing in <#${channel.id}>.`,
+ allowedMentions: AllowedMentions.none()
+ });
+ }
+}