added rzeczy
This commit is contained in:
36
src/commands/forceplay.ts
Normal file
36
src/commands/forceplay.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { CacheType, ChatInputCommandInteraction, SlashCommandBuilder } from 'discord.js';
|
||||
import { connectToChannelByInteraction } from '../util/helpers';
|
||||
import { forceRequestSong } from '../playback';
|
||||
import { getPlayMsg } from '../messages';
|
||||
|
||||
const name = "forceplay"
|
||||
|
||||
function register() {
|
||||
return new SlashCommandBuilder()
|
||||
.setName(name)
|
||||
.setDescription('YT')
|
||||
.addStringOption((option) => option.setName("url")
|
||||
.setDescription("YT url")
|
||||
.setRequired(true))
|
||||
}
|
||||
|
||||
async function execute(interaction: ChatInputCommandInteraction<CacheType>) {
|
||||
try {
|
||||
connectToChannelByInteraction(interaction)
|
||||
|
||||
const url = interaction.options.getString("url")!;
|
||||
await forceRequestSong(interaction, url)
|
||||
|
||||
const msg = getPlayMsg(url)
|
||||
await interaction.reply(msg);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
await interaction.reply('Coś poszło nie tak :/');
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
name,
|
||||
register,
|
||||
execute
|
||||
}
|
||||
@@ -1,8 +1,20 @@
|
||||
import forceplay from "./forceplay"
|
||||
import help from "./help"
|
||||
import pause from "./pause"
|
||||
import ping from "./ping"
|
||||
import play from "./play"
|
||||
import queue from "./queue"
|
||||
import resume from "./resume"
|
||||
import stop from "./stop"
|
||||
|
||||
export const commands: {[key: string]: Command} = {
|
||||
export const commands: { [key: string]: Command } = {
|
||||
ping,
|
||||
play,
|
||||
forceplay,
|
||||
queue,
|
||||
help,
|
||||
resume,
|
||||
stop,
|
||||
pause,
|
||||
}
|
||||
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
import { CacheType, ChatInputCommandInteraction, SlashCommandBuilder } from 'discord.js';
|
||||
import { connectToChannel } from '../util/helpers';
|
||||
import { joinVoiceChannel } from '@discordjs/voice';
|
||||
|
||||
const name = "ping"
|
||||
|
||||
function register() {
|
||||
return new SlashCommandBuilder()
|
||||
.setName(name)
|
||||
.setDescription('Replies with Pong!')
|
||||
}
|
||||
|
||||
async function execute(message: ChatInputCommandInteraction<CacheType>) {
|
||||
const channelId = "515300847790325790"
|
||||
}
|
||||
|
||||
export default {
|
||||
name,
|
||||
register,
|
||||
execute
|
||||
}
|
||||
27
src/commands/pause.ts
Normal file
27
src/commands/pause.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { CacheType, ChatInputCommandInteraction, SlashCommandBuilder } from 'discord.js';
|
||||
import { pause_playback } from '../playback';
|
||||
import { player } from '../main';
|
||||
|
||||
|
||||
const name = "pause"
|
||||
|
||||
function register() {
|
||||
return new SlashCommandBuilder()
|
||||
.setName(name)
|
||||
.setDescription('pause playback')
|
||||
}
|
||||
|
||||
async function execute(interaction: ChatInputCommandInteraction<CacheType>) {
|
||||
try {
|
||||
pause_playback(player)
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
await interaction.reply('Coś poszło nie tak :/');
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
name,
|
||||
register,
|
||||
execute
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { CacheType, ChatInputCommandInteraction, SlashCommandBuilder } from 'discord.js';
|
||||
import { connectToChannel, playSong } from '../util/helpers';
|
||||
import { player } from '../main';
|
||||
import { get_audio } from '../util/downloader';
|
||||
import { connectToChannelByInteraction } from '../util/helpers';
|
||||
import { requestSong } from '../playback';
|
||||
import { getPlayMsg } from '../messages';
|
||||
|
||||
const name = "play"
|
||||
|
||||
@@ -16,27 +16,14 @@ function register() {
|
||||
|
||||
async function execute(interaction: ChatInputCommandInteraction<CacheType>) {
|
||||
try {
|
||||
// await interaction.reply(`${interaction}`);
|
||||
const member = await interaction.guild?.members.fetch(interaction.user.id);
|
||||
if (!member) throw new Error("ale chuj")
|
||||
const voiceChannel = member.voice.channel;
|
||||
if (!voiceChannel) throw new Error("ale chuj 2")
|
||||
connectToChannelByInteraction(interaction)
|
||||
|
||||
const connection = await connectToChannel(voiceChannel);
|
||||
connection.subscribe(player);
|
||||
|
||||
await interaction.reply('https://gitea.papryk.com/Papryk/dj-spangebob pull requesty milewidziane XD');
|
||||
const url = interaction.options.getString("url")!;
|
||||
const path = await get_audio(url)
|
||||
// const path = "/home/patryk/Papryk/dbot/data/Kino - Summer is ending ⧸ Кино - Кончится лето [6VqiMQoMXmw].opus"
|
||||
console.log(path)
|
||||
|
||||
await playSong(player, path);
|
||||
await requestSong(interaction, url)
|
||||
|
||||
const msg = getPlayMsg(url)
|
||||
await interaction.reply(msg);
|
||||
} catch (error) {
|
||||
/**
|
||||
* The song isn't ready to play for some reason :(
|
||||
*/
|
||||
console.error(error);
|
||||
await interaction.reply('Coś poszło nie tak :/');
|
||||
}
|
||||
|
||||
24
src/commands/queue.ts
Normal file
24
src/commands/queue.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { CacheType, ChatInputCommandInteraction, SlashCommandBuilder } from 'discord.js';
|
||||
import { getQueue } from '../playback';
|
||||
|
||||
const name = "queue"
|
||||
|
||||
function register() {
|
||||
return new SlashCommandBuilder()
|
||||
.setName(name)
|
||||
.setDescription('Shows queue')
|
||||
}
|
||||
|
||||
async function execute(interaction: ChatInputCommandInteraction<CacheType>) {
|
||||
console.log(interaction.member)
|
||||
const queue = getQueue()
|
||||
await interaction.reply(`Current: ${queue.current}
|
||||
Queue:
|
||||
${queue.songList.join('\n ')}`);
|
||||
}
|
||||
|
||||
export default {
|
||||
name,
|
||||
register,
|
||||
execute
|
||||
}
|
||||
27
src/commands/resume.ts
Normal file
27
src/commands/resume.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { CacheType, ChatInputCommandInteraction, SlashCommandBuilder } from 'discord.js';
|
||||
import { resume_playback } from '../playback';
|
||||
import { player } from '../main';
|
||||
|
||||
|
||||
const name = "resume"
|
||||
|
||||
function register() {
|
||||
return new SlashCommandBuilder()
|
||||
.setName(name)
|
||||
.setDescription('resume playback')
|
||||
}
|
||||
|
||||
async function execute(interaction: ChatInputCommandInteraction<CacheType>) {
|
||||
try {
|
||||
resume_playback(player)
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
await interaction.reply('Coś poszło nie tak :/');
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
name,
|
||||
register,
|
||||
execute
|
||||
}
|
||||
27
src/commands/stop.ts
Normal file
27
src/commands/stop.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { CacheType, ChatInputCommandInteraction, SlashCommandBuilder } from 'discord.js';
|
||||
import { stop_playback } from '../playback';
|
||||
import { player } from '../main';
|
||||
|
||||
|
||||
const name = "stop"
|
||||
|
||||
function register() {
|
||||
return new SlashCommandBuilder()
|
||||
.setName(name)
|
||||
.setDescription('stop playback')
|
||||
}
|
||||
|
||||
async function execute(interaction: ChatInputCommandInteraction<CacheType>) {
|
||||
try {
|
||||
stop_playback(player)
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
await interaction.reply('Coś poszło nie tak :/');
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
name,
|
||||
register,
|
||||
execute
|
||||
}
|
||||
Reference in New Issue
Block a user