1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
const { REST } = require("@discordjs/rest");
const { Routes } = require("discord-api-types/v9");
const Discord = require("discord.js");
const ytdl = require("ytdl-core");
const {
joinVoiceChannel,
createAudioPlayer,
StreamType,
AudioPlayerStatus,
VoiceConnectionStatus, entersState, createAudioResource,
} = require("@discordjs/voice");
const { createDiscordJSAdapter } = require("./adapter");
const PREFIX = "//";
const COMMANDS = [
{
name: "apply",
description: "Replies with the application link for yucky! aiming."
},
{
name: "discord",
description: "Replies with the invite link to yucky! aimings Discord server."
},
{
name: "twitter",
description: "Replies with the link to yucky! aimings Twitter."
},
{
name: "github",
description: "Replies with the link to yucky! aimings GitHub."
},
{
name: "steam",
description: "Replies with the invite link to yucky! aimings Steam group."
},
{
name: "youtube",
description: "Replies with the link to yucky! aimings YouTube channel."
},
{
name: "press",
description: "Replies with the link to yucky! aimings press pack."
},
];
const player = createAudioPlayer();
const client = new Discord.Client(
{
intents: [
Discord.Intents.FLAGS.GUILDS,
Discord.Intents.FLAGS.GUILD_MESSAGES,
Discord.Intents.FLAGS.GUILD_VOICE_STATES,
],
}
);
const rest = new REST({ version: "9" })
.setToken("ODg5NDE0MDUzNjE1Nzk2Mjg3.YUg5Yg.2i3KiNfOXC2AbuBg-8jM3InxmuI");
const connectToChannel = async (channel) => {
const connection = joinVoiceChannel({
channelId: channel.id,
guildId: channel.guild.id,
adapterCreator: createDiscordJSAdapter(channel),
});
try {
await entersState(connection, VoiceConnectionStatus.Ready, 30e3);
return connection;
} catch (error) { connection.destroy(); throw error; }
};
const playURL = url => {
const resource = createAudioResource(url, { inputType: StreamType.Arbitrary });
player.play(resource);
return entersState(player, AudioPlayerStatus.Playing, 5e3);
}
(async () => {
try {
console.log("started resfreshing application (/) commands.");
await rest.put(
Routes.applicationGuildCommands(
"889414053615796287",
"888524070432423957"
),
{ body: COMMANDS },
);
console.log("successfully reloaded application (/) commands.");
} catch (error) {
console.error(error);
}
})();
client.on("ready", () => {
console.log(`logged in as ${client.user.tag}.`);
client.user.setActivity("your applications", { type: "WATCHING" });
});
client.on("error", console.error)
client.on("interactionCreate", async interaction => {
if (!interaction.isCommand()) { return; }
switch (interaction.commandName) {
case "apply": {
await interaction.reply("https://fuwn.link/apply2yucky")
} break;
case "discord": {
await interaction.reply("https://discord.io/yucky")
} break;
case "twitter": {
await interaction.reply("https://twitter.com/yuckyaiming")
} break;
case "github": {
await interaction.reply("https://github.com/yuckyaiming")
} break;
case "steam": {
await interaction.reply("https://steamcommunity.com/groups/yucky_de")
} break;
case "youtube": {
await interaction.reply("https://www.youtube.com/channel/UCDZsU0eaFU0HjcM_1bpYbUA")
} break;
case "press": {
await interaction
.reply("https://drive.google.com/drive/folders/1A7TJ-PXqYqJ5VHBtzvYInFOEpA3Gk8zC?usp=sharing")
} break;
}
});
client.on("messageCreate", async message => {
let arguments;
let command;
if (message.author.id === client.user.id) { return; }
if (message.content.startsWith(PREFIX)) {
arguments = message.content.slice(PREFIX.length).split(/ +/);
command = arguments.shift().toLowerCase();
} else {
return;
}
switch (command) {
case "say": {
await message.delete();
if (message.author.id === "217348698294714370") {
await message.channel.send(arguments.join(" "));
}
} break;
case "join": {
await message.delete();
if (message.author.id === "217348698294714370") {
const connection = await connectToChannel(message.member.voice.channel);
}
} break;
case "play": {
await message.delete();
if (message.author.id === "217348698294714370") {
const connection = await connectToChannel(message.member.voice.channel);
await playURL("https://www.soundjay.com/human/fart-01.mp3");
connection.subscribe(player);
}
} break;
}
});
client.login("ODg5NDE0MDUzNjE1Nzk2Mjg3.YUg5Yg.2i3KiNfOXC2AbuBg-8jM3InxmuI");
|