bxr
bxr
Explore posts from servers
DTDrizzle Team
Created by bxr on 11/29/2023 in #help
Supabase/postgres get query is stuck on prod app
No description
25 replies
DIAdiscord.js - Imagine an app
Created by bxr on 11/28/2023 in #djs-questions
Member Permissions for subcommand groups?
Are we able to add member permissions to subcommand groups? I have a SlashCommandBuilder command group for channel related actions. Some commands should only be available for admins and some for mods... But I only see that we are able to add DefaultMemberPermissions to the SlashCommandBuilder as a whole:
xport const channelSlashCommand: SlashCommandBuilder =
new SlashCommandBuilder()
.setName('channel')
.setDescription('Set of admin commands for channel management')
.addSubcommandGroup((group) =>
group
.setName('admin')
.setDescription('Add, remove, list channels from db')
.addSubcommand((subcommand) =>
subcommand
.setName('add')
.setDescription('Add chanel to DB')
.addChannelOption((option) =>
option
.setName('channel')
.setDescription('Select the channel you want to set')
.addChannelTypes(ChannelType.GuildText)
.setRequired(true),
)
.addStringOption((option) =>
option
.setName('type')
.setDescription("The channel's type")
.addChoices(
{ name: 'Announcement', value: 'announcement' },
{ name: 'General', value: 'general' },
{ name: 'Success', value: 'success' },
)
.setRequired(true),
)
.addRoleOption((option) =>
option
.setName('role')
.setDescription(
'Select the role you want to alert when sending messages to this channel',
),
),
)
.addSubcommand((subcommand) =>
subcommand
.setName('delete')
.setDescription('delete a channel from db')
.addStringOption((option) =>
option
.setName('channel_id')
.setDescription('Enter the channel ID')
.setRequired(true),
),
)
.addSubcommand((subcommand) =>
subcommand.setName('list').setDescription('List current channels'),
),
)
.addSubcommandGroup((group) =>
group
.setName('mod')
.setDescription('Channel management commands for mods')
.addSubcommand((subcommand) =>
subcommand
.setName('lock')
.setDescription('Lock a channel')
.addChannelOption((option) =>
option
.setName('channel')
.setDescription('Channel to lock')
.setRequired(true),
),
),
)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator);
xport const channelSlashCommand: SlashCommandBuilder =
new SlashCommandBuilder()
.setName('channel')
.setDescription('Set of admin commands for channel management')
.addSubcommandGroup((group) =>
group
.setName('admin')
.setDescription('Add, remove, list channels from db')
.addSubcommand((subcommand) =>
subcommand
.setName('add')
.setDescription('Add chanel to DB')
.addChannelOption((option) =>
option
.setName('channel')
.setDescription('Select the channel you want to set')
.addChannelTypes(ChannelType.GuildText)
.setRequired(true),
)
.addStringOption((option) =>
option
.setName('type')
.setDescription("The channel's type")
.addChoices(
{ name: 'Announcement', value: 'announcement' },
{ name: 'General', value: 'general' },
{ name: 'Success', value: 'success' },
)
.setRequired(true),
)
.addRoleOption((option) =>
option
.setName('role')
.setDescription(
'Select the role you want to alert when sending messages to this channel',
),
),
)
.addSubcommand((subcommand) =>
subcommand
.setName('delete')
.setDescription('delete a channel from db')
.addStringOption((option) =>
option
.setName('channel_id')
.setDescription('Enter the channel ID')
.setRequired(true),
),
)
.addSubcommand((subcommand) =>
subcommand.setName('list').setDescription('List current channels'),
),
)
.addSubcommandGroup((group) =>
group
.setName('mod')
.setDescription('Channel management commands for mods')
.addSubcommand((subcommand) =>
subcommand
.setName('lock')
.setDescription('Lock a channel')
.addChannelOption((option) =>
option
.setName('channel')
.setDescription('Channel to lock')
.setRequired(true),
),
),
)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator);
5 replies
DTDrizzle Team
Created by bxr on 8/14/2023 in #help
Default value for Array creates an incorrect SQL migration
I'm currently adding a new field roles to my PG table, users, such as:
export const users = pgTable(
'users',
{
user_id: text('user_id').primaryKey(),
balance: integer('balance').notNull().default(0),
roles: text('roles').array().default(['user']),
},
(table) => {
return {
user_idIdx: uniqueIndex('user_id_idx').on(table.user_id),
};
},
);
export const users = pgTable(
'users',
{
user_id: text('user_id').primaryKey(),
balance: integer('balance').notNull().default(0),
roles: text('roles').array().default(['user']),
},
(table) => {
return {
user_idIdx: uniqueIndex('user_id_idx').on(table.user_id),
};
},
);
The problem is that when I generate the SQL schema it returns this:
ALTER TABLE "users" ADD COLUMN "roles" text[] DEFAULT user;
ALTER TABLE "users" ADD COLUMN "roles" text[] DEFAULT user;
which is wrong since it thinks it's referencing to a user table but not just a default string value called user
1 replies
DTDrizzle Team
Created by bxr on 7/16/2023 in #help
Module '"drizzle-orm/mysql-core"' has no exported member 'unique'.ts(2305)
Getting this error when trying to import unique
import {
text,
unique, // erroring out
mysqlTable,
serial,
mysqlEnum,
} from 'drizzle-orm/mysql-core';
import {
text,
unique, // erroring out
mysqlTable,
serial,
mysqlEnum,
} from 'drizzle-orm/mysql-core';
13 replies
DTDrizzle Team
Created by bxr on 7/11/2023 in #help
mysql-core fails on TS build on 0.27.1
Getting this error when I try to build my ts node app
3 replies