summaryrefslogtreecommitdiff
path: root/bot.js
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-10-06 21:07:29 -0700
committerFuwn <[email protected]>2021-10-06 21:07:29 -0700
commit55327a3ce7afff8e9d5420b53bdcbe58c5783b7a (patch)
tree85a47b40229d0d0495740b5f023944cc82547f53 /bot.js
downloadbot-55327a3ce7afff8e9d5420b53bdcbe58c5783b7a.tar.xz
bot-55327a3ce7afff8e9d5420b53bdcbe58c5783b7a.zip
feat: discord.js rewrite
Diffstat (limited to 'bot.js')
-rw-r--r--bot.js124
1 files changed, 124 insertions, 0 deletions
diff --git a/bot.js b/bot.js
new file mode 100644
index 0000000..20c8ec5
--- /dev/null
+++ b/bot.js
@@ -0,0 +1,124 @@
+const { REST } = require("@discordjs/rest");
+const { Routes } = require("discord-api-types/v9");
+const Discord = require("discord.js");
+
+const client = new Discord.Client({ intents: [Discord.Intents.FLAGS.GUILDS] });
+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 rest = new REST({ version: "9" })
+ .setToken("ODg5NDE0MDUzNjE1Nzk2Mjg3.YUg5Yg.2i3KiNfOXC2AbuBg-8jM3InxmuI");
+
+(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;
+//
+// console.log(message);
+//
+// if (message.content.startsWith(">")) {
+// arguments = message.content.slice(">".length).split(/ +/);
+// command = arguments.shift().toLowerCase();
+//
+// console.log(arguments);
+// console.log(command);
+// } else {
+// return;
+// }
+//
+// switch (message) {
+// case "say": {
+// if (message.author.id === "217348698294714370") {
+// await message.delete();
+//
+// message.channel.startTyping();
+//
+// message.channel.send(arguments.join(" "));
+//
+// return message.channel.stopTyping();
+// }
+// } break;
+// }
+// });
+
+client.login("ODg5NDE0MDUzNjE1Nzk2Mjg3.YUg5Yg.2i3KiNfOXC2AbuBg-8jM3InxmuI");