Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull command #38

Open
wants to merge 7 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions commands/proje-oluştur.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
const { SlashCommandBuilder,PermissionsBitField,ChannelType } = require('discord.js')

module.exports = {
data: new SlashCommandBuilder()
.setName('proje-oluştur')
.setDescription('Proje oluşturmanızı sağlar.')
.addStringOption((option) =>
option
.setName('projectname')
.setDescription('Proje adinizi giriniz.')
.setRequired(true)
),

async execute(interaction, data) {
try {
if(interaction.member.permissions.has(PermissionsBitField.Flags.ManageGuild)){
const text = interaction.options.getString("projectname");
const categorycik = await interaction.guild.channels.create({name: `${text}`, type: ChannelType.GuildCategory });
await interaction.reply({content: `Created **${text}** category!`, ephemeral: true});
interaction.guild.roles.create({name:`${text}-backend-lead`, permissions: [PermissionsBitField.Flags.ViewChannel]})
interaction.guild.roles.create({name:`${text}-front-end-lead`, permissions: [PermissionsBitField.Flags.ViewChannel]})
interaction.guild.roles.create({name:`${text}-pm`, permissions: [PermissionsBitField.Flags.ViewChannel]})
let berke = await interaction.guild.roles.cache.find(x => x.name == `${text}-backend-lead`);
let berke2 = await interaction.guild.roles.cache.find(x => x.name == `${text}-front-end-lead`);
let berke3 = await interaction.guild.roles.cache.find(x => x.name == `${text}-pm`);
interaction.guild.channels.create({name: `${text}`,
type: ChannelType.GuildText,
parent: categorycik,
});
interaction.guild.channels.create({name: `${text}`,
type: ChannelType.GuildVoice,
parent: categorycik,
});
}else {
await interaction.reply("yapamazsin.")
}

} catch (err) {
console.log(err)
}
},
}
29 changes: 29 additions & 0 deletions commands/rol-ver-al.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const { SlashCommandBuilder } = require('discord.js')

module.exports = {
data: new SlashCommandBuilder()
.setName('rolekle')
.setDescription('Kullanıcıya rol eklemenizi sağlar.')
.addUserOption((option) => option.setName('user').setDescription('Rolü vermek istediğiniz kullanıcıyı giriniz.').setRequired(true))
.addRoleOption((option)=> option.setName('role').setDescription('Vermek istediğiniz rolü giriniz.').setRequired(true)),

async execute(interaction) {
try {
const users = interaction.options.getMember('user');
const rol = interaction.options.getRole('role');
if(users.roles.cache.has(rol.id)){
await interaction.reply({content:`${users} adlı kullanıcıdan ${rol} rolünü aldınız.`, ephemeral: true })
await users.roles.remove(rol);
}
else {
await users.roles.add(rol);
await interaction.reply({content:`${users} adlı kullanıcıya ${rol} rolünü eklediniz.`, ephemeral: true })
}
} catch (error) {
console.error(error)
await interaction.reply(
`Rol eklenemedi. Hata: ${error.rawError.code} - ${error.rawError.message}`,
)
}
},
}
56 changes: 56 additions & 0 deletions commands/zamanla.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
const {SlashCommandBuilder, ChannelType } = require('discord.js')
const schedule = require('node-schedule');
module.exports = {
data: new SlashCommandBuilder()
.setName('zamanla')
.setDescription('Mesajınız zamanlama.')
.addStringOption((option) =>
option
.setName('message')
.setDescription('Mesajınızı giriniz.')
.setMinLength(10)
.setMaxLength(2000)
.setRequired(true)
)
.addIntegerOption((option) =>
option
.setName('time')
.setDescription('Mesajınız hangi zamana göre gönderilsin?')
.setChoices(
{ name: '30 saniye', value: 15000 },
{ name: '1 Dakika', value: 60000 },
{ name: '15 Dakika', value: 900000 },
{ name: '30 Dakika', value: 1800000 },
{ name: '1 Saat', value: 3600000 }
)
.setRequired(true)
)
.addChannelOption((option) =>
option
.setName('channel')
.setDescription('Mesajınızı Hangi Kanala Göndermek istiyorsunuz?')
.addChannelTypes(ChannelType.GuildText)
.setRequired(true)
),

async execute(interaction) {
try{
const message = interaction.options.getString('message');
const time = interaction.options.getInteger('time');
const channel = interaction.options.getChannel('channel');

const date = new Date(new Date().getTime() + time);
interaction.reply({
content: `Mesajınız tarihine ayarlandı. ${date.toTimeString()}`,
});
console.log(date);
schedule.scheduleJob(date, () => {
channel.send({ content: message });
})
} catch (error) {
console.error(error)
)
}
},
}

28 changes: 28 additions & 0 deletions commands/çek.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const { SlashCommandBuilder } = require('discord.js')

module.exports = {
data: new SlashCommandBuilder()
.setName('cek')
.setDescription('Kullanıcıyı odanıza çekmenizi sağlar.')
.addUserOption((option) => option.setName('user').setDescription('Odaya çekmek istediğiniz kullanıcıyı giriniz.').setRequired(true)),

async execute(interaction) {
try {
const users = interaction.options.getMember('user');
if(!users) return interaction.reply({content: "Geçerli bir kullanıcı etiketlemelisin.",ephemeral: true})

if(users.id === interaction.member.id) return interaction.reply({content:"Kendinizi çekemezsiniz!", ephemeral: true})

if(!users.voice.channel) return interaction.reply({content: "Kullanıcı seste bulunmuyor.",ephemeral: true})

if(interaction.member.voice.channelId === users.voice.channelId) return interaction.reply({content: "Zaten kullanıcı ile aynı kanaldasın.",ephemeral: true})

users.voice.setChannel(interaction.member.voice.channelId);
interaction.reply({content: `${users} adlı kişiyi başarılı şekilde yanınıza çektiniz. ${interaction.member.voice.channel}`,ephemeral: true})

console.log(`${users.id} idli kişiyi başarılı şekilde ${interaction.member.voice.channel.name} adlı kanala çektiniz.`);
} catch (error) {
console.error(error)
}
},
}