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

feat: dutch translation #71

Merged
merged 7 commits into from
Feb 21, 2022
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {Logger} from "./logger";
import {container, LogLevel, SapphireClient} from "@sapphire/framework";
import "@sapphire/plugin-logger/register";
import "@sapphire/plugin-i18next/register";
import "./container";
config();

const client = new SapphireClient({
Expand Down
52 changes: 26 additions & 26 deletions src/commands/clear.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import { SlashCommandBuilder } from "@discordjs/builders";
import { ApplyOptions } from "@sapphire/decorators";
import { ApplicationCommandRegistry, Command, CommandOptions } from "@sapphire/framework";
import { CommandInteraction, MessageEmbed } from "discord.js";
@ApplyOptions<CommandOptions>({
description: "clear the queue",
preconditions: ["GuildOnly", "BotInVoice", "InSameVoice"]
})
export class ClearCommand extends Command {
public registerApplicationCommands(registry: ApplicationCommandRegistry) {
registry.registerChatInputCommand(new SlashCommandBuilder().setName(this.name).setDescription(this.description));
}
public async chatInputRun(interaction: CommandInteraction) {
await interaction.deferReply();
this.container.player.getQueue(interaction.guild).clear();
interaction.editReply({
embeds: [
new MessageEmbed({
color: "GREEN",
title: "Queue cleared",
description: "The queue has been cleared."
})
]
});
}
}
import { SlashCommandBuilder } from "@discordjs/builders";
import { ApplyOptions } from "@sapphire/decorators";
import { ApplicationCommandRegistry, Command, CommandOptions } from "@sapphire/framework";
import { CommandInteraction, MessageEmbed } from "discord.js";
@ApplyOptions<CommandOptions>({
description: "clear the queue",
preconditions: ["GuildOnly", "BotInVoice", "InSameVoice"]
})
export class ClearCommand extends Command {
public registerApplicationCommands(registry: ApplicationCommandRegistry) {
registry.registerChatInputCommand(new SlashCommandBuilder().setName(this.name).setDescription(this.description));
}
public async chatInputRun(interaction: CommandInteraction) {
await interaction.deferReply();
this.container.player.getQueue(interaction.guild).clear();
interaction.editReply({
embeds: [
new MessageEmbed({
color: "GREEN",
title: this.container.getTranslation(interaction, "commands/clear:success.title"),
description: this.container.getTranslation(interaction, "commands/clear:success.description")
})
]
});
}
}
64 changes: 32 additions & 32 deletions src/commands/disconnect.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
import { SlashCommandBuilder } from "@discordjs/builders";
import { ApplyOptions } from "@sapphire/decorators";
import { ApplicationCommandRegistry, Command, CommandOptions } from "@sapphire/framework";
import { CommandInteraction, MessageEmbed } from "discord.js";

@ApplyOptions<CommandOptions>({
description: "let the bot disconnect from the currently joined voice channel",
preconditions: ["GuildOnly", "BotInVoice", "InSameVoice"]
})
export class DisconnectCommand extends Command {
public registerApplicationCommands(registry: ApplicationCommandRegistry) {
registry.registerChatInputCommand(new SlashCommandBuilder().setName(this.name).setDescription(this.description));
}

public async chatInputRun(interaction: CommandInteraction) {
await interaction.deferReply();

const {guild} = interaction,
{channel} = guild.me.voice;

this.container.player.deleteQueue(guild);

interaction.editReply({
embeds: [
new MessageEmbed({
color: "GREEN",
title: "Disconnect",
description: `Disconnected from \`${channel.name}\` 🔊`
})
]
});
}
import { SlashCommandBuilder } from "@discordjs/builders";
import { ApplyOptions } from "@sapphire/decorators";
import { ApplicationCommandRegistry, Command, CommandOptions } from "@sapphire/framework";
import { CommandInteraction, MessageEmbed } from "discord.js";
@ApplyOptions<CommandOptions>({
description: "let the bot disconnect from the currently joined voice channel",
preconditions: ["GuildOnly", "BotInVoice", "InSameVoice"]
})
export class DisconnectCommand extends Command {
public registerApplicationCommands(registry: ApplicationCommandRegistry) {
registry.registerChatInputCommand(new SlashCommandBuilder().setName(this.name).setDescription(this.description));
}
public async chatInputRun(interaction: CommandInteraction) {
await interaction.deferReply();
const {guild} = interaction,
{channel} = guild.me.voice;
this.container.player.deleteQueue(guild);
interaction.editReply({
embeds: [
new MessageEmbed({
color: "GREEN",
title: this.container.getTranslation(interaction, "commands/disconnect:success.title"),
description: this.container.getTranslation(interaction, "commands/disconnect:success.description", { replace: { channel: channel.name } })
})
]
});
}
}
72 changes: 36 additions & 36 deletions src/commands/invite.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
import { SlashCommandBuilder } from "@discordjs/builders";
import { ApplyOptions } from "@sapphire/decorators";
import { ApplicationCommandRegistry, Command, CommandOptions } from "@sapphire/framework";
import { stripIndents } from "common-tags";
import { CommandInteraction, MessageEmbed } from "discord.js";

@ApplyOptions<CommandOptions>({
description: "get the invite link of the bot"
})
export class InviteCommand extends Command {
public registerApplicationCommands(registry: ApplicationCommandRegistry) {
registry.registerChatInputCommand(new SlashCommandBuilder().setName(this.name).setDescription(this.description));
}

public async chatInputRun(interaction: CommandInteraction) {
await interaction.deferReply({ephemeral: true});

const {client} = interaction;
interaction.editReply({
embeds: [
new MessageEmbed({
color: "BLUE",
title: "OurTube invite links",
description: stripIndents`
[Recommended](${client.generateInvite({
scopes: ["bot", "applications.commands"]
})})
[Admin](${client.generateInvite({
scopes: ["bot", "applications.commands"],
permissions: ["ADMINISTRATOR"]
})})
`
})
]
});
}
import { SlashCommandBuilder } from "@discordjs/builders";
import { ApplyOptions } from "@sapphire/decorators";
import { ApplicationCommandRegistry, Command, CommandOptions } from "@sapphire/framework";
import { stripIndents } from "common-tags";
import { CommandInteraction, MessageEmbed } from "discord.js";
@ApplyOptions<CommandOptions>({
description: "get the invite link of the bot"
})
export class InviteCommand extends Command {
public registerApplicationCommands(registry: ApplicationCommandRegistry) {
registry.registerChatInputCommand(new SlashCommandBuilder().setName(this.name).setDescription(this.description));
}
public async chatInputRun(interaction: CommandInteraction) {
await interaction.deferReply({ephemeral: true});
const {client} = interaction;
interaction.editReply({
embeds: [
new MessageEmbed({
color: "BLUE",
title: this.container.getTranslation(interaction, "commands/invite:success.title"),
description: stripIndents`
[${this.container.getTranslation(interaction, "commands/invite:success.recommended")}](${client.generateInvite({
scopes: ["bot", "applications.commands"]
})})
[${this.container.getTranslation(interaction, "commands/invite:success.admin")}](${client.generateInvite({
scopes: ["bot", "applications.commands"],
permissions: ["ADMINISTRATOR"]
})})
`
})
]
});
}
}
138 changes: 69 additions & 69 deletions src/commands/join.ts
Original file line number Diff line number Diff line change
@@ -1,70 +1,70 @@
import { SlashCommandBuilder } from "@discordjs/builders";
import { ApplyOptions } from "@sapphire/decorators";
import { ApplicationCommandRegistry, Command, CommandOptions } from "@sapphire/framework";
import { CommandInteraction, GuildMember, MessageEmbed } from "discord.js";

@ApplyOptions<CommandOptions>({
description: "let the bot join your voice channel",
preconditions: ["GuildOnly", "UserInVoice"],
requiredClientPermissions: ["CONNECT"]
})
export class JoinCommand extends Command {
public registerApplicationCommands(registry: ApplicationCommandRegistry) {
registry.registerChatInputCommand(new SlashCommandBuilder().setName(this.name).setDescription(this.description));
}

/**
* Join the voice channel of the interaction member
* @param interaction The interaction to get guild data from
* @returns The created queue of the interaction guild
*/
public async joinChannel(interaction: CommandInteraction) {
const {member, guild} = interaction,
{player} = this.container,
{voice} = member as GuildMember;

const queue = player.createQueue(guild, {
leaveOnEmpty: false,
leaveOnEnd: false,
ytdlOptions: {
quality: "highest",
filter: "audioonly",
highWaterMark: 1 << 25,
dlChunkSize: 0
},
metadata: interaction
});

try {
if (!queue.connection) await queue.connect(voice.channel);
} catch {
player.deleteQueue(guild);
return void interaction.editReply({
embeds: [
new MessageEmbed({
color: "RED",
title: "Can't join voice channel",
description: "Unable to join your voice channel"
})
]
});
}

return queue;
}

public async chatInputRun(interaction: CommandInteraction) {
await interaction.deferReply();
if(!await this.joinChannel(interaction)) return;

interaction.editReply({
embeds: [
new MessageEmbed({
color: "GREEN",
title: "Join",
description: `Joined \`${(interaction.member as GuildMember).voice.channel.name}\` 🔊`
})
]
});
}
import { SlashCommandBuilder } from "@discordjs/builders";
import { ApplyOptions } from "@sapphire/decorators";
import { ApplicationCommandRegistry, Command, CommandOptions } from "@sapphire/framework";
import { CommandInteraction, GuildMember, MessageEmbed } from "discord.js";
@ApplyOptions<CommandOptions>({
description: "let the bot join your voice channel",
preconditions: ["GuildOnly", "UserInVoice"],
requiredClientPermissions: ["CONNECT"]
})
export class JoinCommand extends Command {
public registerApplicationCommands(registry: ApplicationCommandRegistry) {
registry.registerChatInputCommand(new SlashCommandBuilder().setName(this.name).setDescription(this.description));
}
/**
* Join the voice channel of the interaction member
* @param interaction The interaction to get guild data from
* @returns The created queue of the interaction guild
*/
public async joinChannel(interaction: CommandInteraction) {
const {member, guild} = interaction,
{player} = this.container,
{voice} = member as GuildMember;
const queue = player.createQueue(guild, {
leaveOnEmpty: false,
leaveOnEnd: false,
ytdlOptions: {
quality: "highest",
filter: "audioonly",
highWaterMark: 1 << 25,
dlChunkSize: 0
},
metadata: interaction
});
try {
if (!queue.connection) await queue.connect(voice.channel);
} catch {
player.deleteQueue(guild);
return void interaction.editReply({
embeds: [
new MessageEmbed({
color: "RED",
title: this.container.getTranslation(interaction, "commands/join:error.title"),
description: this.container.getTranslation(interaction, "commands/join:error.description")
})
]
});
}
return queue;
}
public async chatInputRun(interaction: CommandInteraction) {
await interaction.deferReply();
if(!await this.joinChannel(interaction)) return;
interaction.editReply({
embeds: [
new MessageEmbed({
color: "GREEN",
title: this.container.getTranslation(interaction, "commands/join:success.title"),
description: this.container.getTranslation(interaction, "commands/join:success.description", { replace: { channel: (interaction.member as GuildMember).voice.channel.name}})
})
]
});
}
}
Loading