Skip to content

Commit

Permalink
Merge pull request #676 from hwangsihu/main
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
LucasB25 authored Aug 16, 2024
2 parents 851d942 + 0e81952 commit 782d618
Show file tree
Hide file tree
Showing 8 changed files with 286 additions and 183 deletions.
6 changes: 0 additions & 6 deletions .github/dependabot.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/biome.yml

This file was deleted.

6 changes: 2 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,14 @@ on:
pull_request:
# The branches below must be a subset of the branches above
branches: ['main']
schedule:
- cron: '18 20 * * 3'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
actions: write
contents: write
security-events: write

strategy:
Expand Down
2 changes: 1 addition & 1 deletion locales/EnglishUS.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@
}
},
"grab": {
"loading": "Loading...",
"description": "Grabs the current playing song on your DM",
"loading": "Loading...",
"content": "**Duration:** {length}\n**Requested by:** <@{requester}>\n**Link:** [Click here]({uri})",
"check_dm": "Please check your DM.",
"dm_failed": "I couldn't send you a DM. Please make sure allow direct messages is turned on."
Expand Down
6 changes: 3 additions & 3 deletions locales/Korean.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
},
"botinfo": {
"description": "봇에 대한 정보를 표시해요",
"content": "봇 정보:\n- **운영체제**: {osInfo}\n- **가동시간**: {osUptime}\n- **컴퓨터 이름**: {osHostname}\n- **CPU 아키텍처**: {cpuInfo}\n- **CPU 사용량**: {cpuUsed}%\n- **메모리 사용량**: {memUsed}MB / {memTotal}GB\n- **Node 버전**: {nodeVersion}\n- **Discord 버전**: {discordJsVersion}\n- {guilds} 서버, {channels} 채널, {users} 유저 캐시됨\n- **명령어 수**: {commands}개"
"content": "봇 정보:\n- **운영 체제**: {osInfo}\n- **업타임**: {osUptime}\n- **호스트 이름**: {osHostname}\n- **CPU 아키텍처**: {cpuInfo}\n- **CPU 사용량**: {cpuUsed}%\n- **메모리 사용량**: {memUsed}MB / {memTotal}GB\n- **Node 버전**: {nodeVersion}\n- **Discord 버전**: {discordJsVersion}\n- 서버 {guilds}개, 채널 {channels}개, 멤버 {users}\n- **명령어 수**: {commands}개"
},
"about": {
"description": "봇에 대해 알려줘요",
Expand Down Expand Up @@ -582,10 +582,10 @@
"missing_arguments_description": "`{command}` 명령어에 필요한 인수를 지정해주세요.\n\n예시:\n{examples}",
"syntax_footer": "구문: [] = 선택, <> = 필수",
"cooldown": "`{command}` 명령어를 사용하려면 {time}초동안 기다려야 해요.",
"no_mention_everyone": "이 명령어는 everyone나 here 멘션으로 사용할 수 없어요. 빗금 명령으로 사용해주세요.",
"no_mention_everyone": "이 명령어는 everyone나 here 멘션으로 사용할 수 없어요. 빗금 명령어로 사용해주세요.",
"error": "오류: `{error}`",
"no_voice_channel_queue": "대기열에 노래를 추가하려면 음성 채널에 접속해주세요.",
"no_permission_connect_speak": "<#{channel}>에서 연결/말하기 권한이 봇에게 없어요.",
"no_permission_connect_speak": "<#{channel}>에서 연결/말하기 권한이 없어요.",
"different_voice_channel_queue": "노래를 대기열에 추가하려면 <#{channel}> 채널에 접속해주세요."
},
"setupButton": {
Expand Down
71 changes: 71 additions & 0 deletions src/commands/dev/CreateInvite.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { ChannelType } from "discord.js";
import { Command, type Context, type Lavamusic } from "../../structures/index.js";

export default class CreateInvite extends Command {
constructor(client: Lavamusic) {
super(client, {
name: "createinvite",
description: {
content: "Create a one-time use, unlimited duration invite link for a guild",
examples: ["createinvite 0000000000000000000"],
usage: "createinvite <guildId>",
},
category: "dev",
aliases: ["ci"],
cooldown: 3,
args: true,
player: {
voice: false,
dj: false,
active: false,
djPerm: null,
},
permissions: {
dev: true,
client: ["SendMessages", "CreateInstantInvite", "ReadMessageHistory", "ViewChannel"],
user: [],
},
slashCommand: false,
options: [],
});
}

public async run(client: Lavamusic, ctx: Context, args: string[]): Promise<any> {
const guildId = args[0];

const guild = client.guilds.cache.get(guildId);

if (!guild) {
return await ctx.sendMessage("Guild not found.");
}

try {
const textChannel = guild.channels.cache.find((channel) => channel.type === ChannelType.GuildText);

if (!textChannel) {
return await ctx.sendMessage("No text channel found in the guild.");
}

const invite = await textChannel.createInvite({
maxUses: 1,
maxAge: 0,
});

await ctx.author.send(`Guild: ${guild.name}\nInvite Link: ${invite.url}`);
await ctx.sendMessage("Invite link has been sent to your DM.");
} catch (_error) {
await ctx.sendMessage("Failed to create invite link.");
}
}
}

/**
* Project: lavamusic
* Author: Appu
* Main Contributor: LucasB25
* Company: Coders
* Copyright (c) 2024. All rights reserved.
* This code is the property of Coder and may not be reproduced or
* modified without permission. For more information, contact us at
* https://discord.gg/ns8CTk9J3e
*/
65 changes: 65 additions & 0 deletions src/commands/dev/DeleteInvites.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { Command, type Context, type Lavamusic } from "../../structures/index.js";

export default class DestroyInvites extends Command {
constructor(client: Lavamusic) {
super(client, {
name: "destroyinvites",
description: {
content: "Destroy all invite links created by the bot in a guild",
examples: ["destroyinvites 0000000000000000000"],
usage: "destroyinvites <guildId>",
},
category: "dev",
aliases: ["di"],
cooldown: 3,
args: true,
player: {
voice: false,
dj: false,
active: false,
djPerm: null,
},
permissions: {
dev: true,
client: ["SendMessages", "ManageGuild", "ReadMessageHistory", "ViewChannel"],
user: [],
},
slashCommand: false,
options: [],
});
}

public async run(client: Lavamusic, ctx: Context, args: string[]): Promise<any> {
const guildId = args[0];

const guild = client.guilds.cache.get(guildId);

if (!guild) {
return await ctx.sendMessage("Guild not found.");
}

try {
const invites = await guild.invites.fetch();

const botInvites = invites.filter((invite) => invite.inviter?.id === client.user?.id);
for (const invite of botInvites.values()) {
await invite.delete();
}

await ctx.sendMessage(`Destroyed ${botInvites.size} invite(s) created by the bot.`);
} catch (_error) {
await ctx.sendMessage("Failed to destroy invites.");
}
}
}

/**
* Project: lavamusic
* Author: Appu
* Main Contributor: LucasB25
* Company: Coders
* Copyright (c) 2024. All rights reserved.
* This code is the property of Coder and may not be reproduced or
* modified without permission. For more information, contact us at
* https://discord.gg/ns8CTk9J3e
*/
Loading

0 comments on commit 782d618

Please sign in to comment.