✞
RNARuby - Not A Framework
Created by on 2/22/2025 in #ruby-not-support
I have use @/ as Root
there is any youtube tutorial that already have done it on spphirejs or something?
10 replies
RNARuby - Not A Framework
Created by on 2/19/2025 in #ruby-not-support
Button Interaction Pass Data
it's working sooo
13 replies
RNARuby - Not A Framework
Created by on 2/19/2025 in #ruby-not-support
Button Interaction Pass Data
instead I made a list, passed the id from the button and retrieved what I needed
13 replies
RNARuby - Not A Framework
Created by on 2/19/2025 in #ruby-not-support
Button Interaction Pass Data
and I even need to send and embed to an other channel and interact with 3 differents button which modify the embeds in different ways
13 replies
RNARuby - Not A Framework
Created by on 2/19/2025 in #ruby-not-support
Button Interaction Pass Data
and about the section section?
13 replies
RNARuby - Not A Framework
Created by on 2/19/2025 in #ruby-not-support
Button Interaction Pass Data
The data must be the following: - balance - choice - userid (owner of the created confilp) - opposite_userid (the member who joined the coinflip) There will be differents games and I even need to handle that too, but I'm not sure if someone can help me out
13 replies
RNARuby - Not A Framework
Created by on 2/18/2025 in #ruby-not-support
How to organize commands?
this is what I have organized the commands
12 replies
RNARuby - Not A Framework
Created by on 2/18/2025 in #ruby-not-support
How to organize commands?
No description
12 replies
RNARuby - Not A Framework
Created by on 2/18/2025 in #ruby-not-support
How to organize commands?
@choke let me know if this is correct
12 replies
RNARuby - Not A Framework
Created by on 2/18/2025 in #ruby-not-support
How to organize commands?
import { ApplyOptions } from '@sapphire/decorators';
import { ChatInputCommand, Command } from '@sapphire/framework';
import { update, userExists } from '../../models/user';
import { ChatInputCommandInteraction } from 'discord.js';
import { amountToSuffix, createEmbed, suffixToAmount } from '../../lib/utils';
import { gemsIcon, knowIcon } from '../../lib/constants';

@ApplyOptions<Command.Options>({
description: 'Add user balance',
preconditions: ['OwnersOnly']
})
export class AdminAddBalance extends Command {
public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) => {
builder
.setName(this.name)
.setDescription(this.description)
.addUserOption((option) => option.setName('user').setDescription('The user to add the balance').setRequired(true))
.addStringOption((option) => option.setName('amount').setDescription('The amount to add').setRequired(true));
});
}

public override async chatInputRun(interaction: ChatInputCommandInteraction, _context: ChatInputCommand.RunContext) {
return await this.sendInfo(interaction);
}

private async sendInfo(interaction: ChatInputCommandInteraction) {
const userOption = interaction.options.getUser('user');
const amountOption = interaction.options.getString('amount');
const { exists, user } = await userExists(userOption?.id as string);

if (!exists || !user) {
return await interaction.reply({ content: 'User not registered', ephemeral: true });
}

const amount = suffixToAmount(amountOption!);

await update(user, { balance: user.balance + amount });

const embed = createEmbed(`${knowIcon} Balance`, `Added ${gemsIcon}${amountToSuffix(amount)} to ${userOption?.username}'s balance.`);

return await interaction.reply({ embeds: [embed] });
}
}
import { ApplyOptions } from '@sapphire/decorators';
import { ChatInputCommand, Command } from '@sapphire/framework';
import { update, userExists } from '../../models/user';
import { ChatInputCommandInteraction } from 'discord.js';
import { amountToSuffix, createEmbed, suffixToAmount } from '../../lib/utils';
import { gemsIcon, knowIcon } from '../../lib/constants';

@ApplyOptions<Command.Options>({
description: 'Add user balance',
preconditions: ['OwnersOnly']
})
export class AdminAddBalance extends Command {
public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) => {
builder
.setName(this.name)
.setDescription(this.description)
.addUserOption((option) => option.setName('user').setDescription('The user to add the balance').setRequired(true))
.addStringOption((option) => option.setName('amount').setDescription('The amount to add').setRequired(true));
});
}

public override async chatInputRun(interaction: ChatInputCommandInteraction, _context: ChatInputCommand.RunContext) {
return await this.sendInfo(interaction);
}

private async sendInfo(interaction: ChatInputCommandInteraction) {
const userOption = interaction.options.getUser('user');
const amountOption = interaction.options.getString('amount');
const { exists, user } = await userExists(userOption?.id as string);

if (!exists || !user) {
return await interaction.reply({ content: 'User not registered', ephemeral: true });
}

const amount = suffixToAmount(amountOption!);

await update(user, { balance: user.balance + amount });

const embed = createEmbed(`${knowIcon} Balance`, `Added ${gemsIcon}${amountToSuffix(amount)} to ${userOption?.username}'s balance.`);

return await interaction.reply({ embeds: [embed] });
}
}
12 replies
RNARuby - Not A Framework
Created by on 2/18/2025 in #ruby-not-support
How to organize commands?
I Will send my code Later for review
12 replies
RNARuby - Not A Framework
Created by on 2/18/2025 in #ruby-not-support
How to organize commands?
i do await
12 replies
RNARuby - Not A Framework
Created by on 2/18/2025 in #ruby-not-support
How to organize commands?
yes i fetch data from MongoDB
12 replies
RNARuby - Not A Framework
Created by on 2/18/2025 in #ruby-not-support
How to organize commands?
what should be awaited??
12 replies
RNARuby - Not A Framework
Created by on 2/18/2025 in #ruby-not-support
Help me to setup this sapphire typescript
ooh i got it
8 replies
RNARuby - Not A Framework
Created by on 2/18/2025 in #ruby-not-support
Help me to setup this sapphire typescript
anyhelp?
8 replies
RNARuby - Not A Framework
Created by on 2/18/2025 in #ruby-not-support
Help me to setup this sapphire typescript
No description
8 replies
RNARuby - Not A Framework
Created by on 2/18/2025 in #ruby-not-support
Help me to setup this sapphire typescript
how do I do it?
8 replies