-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 51392c3
Showing
8 changed files
with
736 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
discord.js v14 slash altyapı |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const { Client, EmbedBuilder } = require("discord.js"); | ||
|
||
module.exports = { | ||
name: "ping", | ||
description: "Bot'un ping değerlerini öğrenirsiniz", | ||
type: 1, | ||
options: [], | ||
|
||
run: async(client, interaction) => { | ||
|
||
const { user, guildId, channel } = interaction; | ||
|
||
|
||
interaction.reply({ embeds: [ new EmbedBuilder().setDescription(`Pong! ***${client.ws.ping}ms***`) ], ephemeral: true }) | ||
|
||
} | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"TOKEN":"Njg1Nzc2NzQ1NzE0MTU1NTgw.GiqVuL.a-CtGZ5mMJJcgV_HN-0I1fyCoyj-WJ76yQjIw8" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const { Collection, EmbedBuilder } = require("discord.js"); | ||
const { readdirSync } = require("fs"); | ||
|
||
module.exports = async(client, interaction) => { | ||
|
||
if(interaction.isChatInputCommand()) { | ||
|
||
if (!interaction.guildId) return; | ||
|
||
readdirSync('./commands').forEach(f => { | ||
|
||
const cmd = require(`../commands/${f}`); | ||
|
||
if(interaction.commandName.toLowerCase() === cmd.name.toLowerCase()) { | ||
|
||
return cmd.run(client, interaction); | ||
|
||
|
||
} | ||
|
||
|
||
}); | ||
|
||
|
||
|
||
} | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const { REST } = require("@discordjs/rest"); | ||
const { Routes } = require("discord-api-types/v10"); | ||
const { TOKEN } = require("../config.json"); | ||
|
||
module.exports = async (client) => { | ||
|
||
const rest = new REST({ version: "10" }).setToken(TOKEN); | ||
try { | ||
await rest.put(Routes.applicationCommands(client.user.id), { | ||
body: client.commands, | ||
}); | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
|
||
console.log(`${client.user.tag} Aktif!`); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
const { Client, GatewayIntentBits, Partials, Collection } = require("discord.js"); | ||
const INTENTS = Object.values(GatewayIntentBits); | ||
const PARTIALS = Object.values(Partials); | ||
const client = new Client({ | ||
intents: INTENTS, | ||
allowedMentions: { | ||
parse: ["users"] | ||
}, | ||
partials: PARTIALS, | ||
retryLimit: 3 | ||
}); | ||
|
||
global.client = client; | ||
client.commands = (global.commands = []); | ||
|
||
const { readdirSync } = require("fs") | ||
const { TOKEN } = require("./config.json"); | ||
|
||
/* Slash Komutları Yüklüyoruz */ | ||
|
||
readdirSync('./commands').forEach(f => { | ||
if(!f.endsWith(".js")) return; | ||
|
||
const props = require(`./commands/${f}`); | ||
|
||
client.commands.push({ | ||
name: props.name.toLowerCase(), | ||
description: props.description, | ||
options: props.options, | ||
dm_permission: props.dm_permission, | ||
type: 1 | ||
}); | ||
|
||
console.log(`[COMMAND] ${props.name} komutu yüklendi.`) | ||
|
||
}); | ||
|
||
|
||
/* Slash Komutları Yüklüyoruz */ | ||
|
||
/* Eventleri Yüklüyoruz */ | ||
|
||
readdirSync('./events').forEach(e => { | ||
|
||
const eve = require(`./events/${e}`); | ||
const name = e.split(".")[0]; | ||
|
||
client.on(name, (...args) => { | ||
eve(client, ...args) | ||
}); | ||
|
||
console.log(`[EVENT] ${name} eventi yüklendi.`) | ||
|
||
}); | ||
|
||
|
||
/* Eventleri Yüklüyoruz */ | ||
|
||
client.login(TOKEN).then(app => { | ||
console.log(`[BOT] Token girişi başarılı.`) | ||
}).catch(app => { | ||
console.log(`[BOT] Token girşi başarısız.`) | ||
}) |
Oops, something went wrong.