Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const ms = require ('ms'); //ازا موجود هيك سطر بملف بوتك ف احذف هل سطر
- client.on('message', async (message) => {
- if (!message.guild) return;
- if (message.author.bot) return;
- if (message.content.startsWith('#lock')) {
- if (!message.member.hasPermission ('MANAGE_CHANNELS')) return;
- var channel = message.mentions.channels.first();
- if (!channel) return message.channel.send ('Example: '+message.content.split(' ')[0]+' <mention channel> <time to open>');
- var time = message.content.split(' ')[2];
- if (!time) return message.channel.send ('Provide a time to open the channel.');
- var lastOptions = channel.permissionOverwrites.get (message.guild.roles.everyone.id);
- channel.updateOverwrite (message.guild.roles.everyone.id, {
- "SEND_MESSAGES": false
- }, 'Timed lock');
- message.channel.send (`**locked ${message.channel} channel for ${time}.**`)
- setTimeout (() => {
- channel.permissionOverwrites.get (message.guild.roles.everyone.id).update (lastOptions) //يرجع برمشنات الروم زي ماكان
- message.channel.send (`**Unlocked ${message.channel} channel.**`);
- }, ms (time));
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement