-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
103 lines (82 loc) · 3.5 KB
/
index.js
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
import { Client as _Client } from "discord.js";
import { Client, GatewayIntentBits, EmbedBuilder } from 'discord.js';
import { REST, Routes } from 'discord.js';
import reply from "./src/command.js";
import {} from 'dotenv/config.js'
const client = new _Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent
]
})
// client.user.setActivity('activity', { type: ActivityType.Watching });
const rest = new REST({ version: '10' }).setToken(process.env.TOKEN);
const commands = [
{
name:'help',
description: 'shows all help commands'
},
{
name:'projects',
description: 'display all open source projects '
},
{
name:'about',
description: 'know about clueless'
}
];
const slashCmds = (async () => {
try {
console.log('Started refreshing application (/) commands.');
await rest.put(Routes.applicationCommands(process.env.CLIENT_ID), { body: commands });
console.log('Successfully reloaded application (/) commands.');
} catch (error) {
console.error(error);
}
});
slashCmds();
client.on("ready", () => { console.log(`Logged in as ${client.user.tag}!`)});
const projectsEmbed = new EmbedBuilder()
.setColor(0x0099FF)
.setTitle('Open Source Projects')
.setURL('https://github.com/Clueless-Community')
.setAuthor({ name: 'ClueLess', iconURL: 'https://www.clueless.tech/ClueLess%20Logo.png', url: 'https://www.clueless.tech/' })
.setDescription('Here are the open-source where you guys can contribute.')
.addFields(
// { name: '\u200B', value: '\u200B' },
{ name: '- ClueLess Official Website', value: 'This is Clueless official website where you can make your developer profile as well as meet new people across the world. \n \n 🔗 - https://github.com/Clueless-Community/clueless-official-website\n \n' },
// add a blank field to the embed
{ name: '- SeamLess UI', value: 'This is a Web UI Kit made with simple HTML and Tailwind CSS. You can use them in any of your projects, be it a simple HTML, CSS static website or a React, Vue, Angular or Next.js Complex app. \n \n 🔗 - https://github.com/Clueless-Community/seamless-ui\n \n' },
{ name: '- First Contribution Website', value: 'A repo where you can make your first contribution and get a contributors card in our website. \n \n 🔗 - https://github.com/Clueless-Community/first-contribution' },
)
.addFields({ name: 'Inline field title', value: 'Some value here', })
.setImage('https://blog.hyperiondev.com/wp-content/uploads/2018/11/Blog-GitHub.jpg')
.setTimestamp()
.setFooter({ text: 'by ClueLess', iconURL: 'https://www.clueless.tech/ClueLess%20Logo.png' });
client.on('messageCreate', (message) => {
// console.log(message.content);
// reads the user message content
// message.reply("hello");
if (message.content === 'hello'){
message.reply("Hello buddy, how are you?")
}
if (message.content === 'projects'){
message.channel.send({ embeds: [projectsEmbed] });
}
})
// slash commands
client.on('interactionCreate', async interaction => {
if (!interaction.isChatInputCommand()) return;
if (interaction.commandName === 'help') {
await interaction.reply(reply[0].content);
}
if (interaction.commandName === 'about') {
await interaction.reply(reply[1].content);
}
if (interaction.commandName === 'projects') {
await interaction.reply(reply[2].content);
}
});
// keepAlive()
client.login(process.env.TOKEN);