Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

add role to channel discord.js

// deleting the channels overwrite for the message author
channel.permissionOverwrites.get(message.author.id).delete();
Comment

add role to channel discord.js

channel.updateOverwrite(channel.guild.roles.everyone, { VIEW_CHANNEL: false });
Comment

add role command discord.js

bot.on('message', (message) => {
    if (!message.content.startsWith(PREFIX) || message.author.bot) return;

    const args = message.content
        .toLowerCase()
        .slice(PREFIX.length)
        .trim()
        .split(/s+/);
    const [command, input] = args;

    if (command === 'clear' || command === 'c') {
        if (!message.member.hasPermission('MANAGE_MESSAGES')) {
            return message.channel
                .send(
                    "Sorry, ale nemáš na to dostatečná práva (`MANAGE_MESSAGES`) :shield: ",
                );
        }

        if (isNaN(input)) {
            return message.channel
                .send('Napiš kolik zpráv mám smazat :eyes: ')
                .then((sent) => {
                    setTimeout(() => {
                        sent.delete();
                    }, 2500);
                });
        }

        if (Number(input) < 0) {
            return message.channel
                .send('Brácho .... rozumím, nemažu nic :clown: ')
                .then((sent) => {
                    setTimeout(() => {
                        sent.delete();
                    }, 2500);
                });
        }

        // add an extra to delete the current message too
        const amount = Number(input) > 100 ?
            101 :
            Number(input) + 1;

        message.channel.bulkDelete(amount, true)
            .then((_message) => {
                message.channel
                    // do you want to include the current message here?
                    // if not it should be ${_message.size - 1}
                    .send(`Smazal jsem `${_message.size}` zpráv :broom:`)
                    .then((sent) => {
                        setTimeout(() => {
                            sent.delete();
                        }, 2500);
                    });
            });
    }

    if (command === 'help' && input === 'clear') {
        const embed = new Discord.MessageEmbed()
            .setColor('#00B2B2')
            .setTitle('**Clear Help**')
            .setDescription(
                `Tento příkaz maže správy. Například takto: `${PREFIX}clear 5` nebo `${PREFIX}c 5`.`,
            )
            .setFooter(
                `Vyžádáno uživatelem: ${message.author.tag}`,
                message.author.displayAvatarURL(),
            )
            .setTimestamp();

        message.channel.send(embed);
    }
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript after 
Javascript :: electron hot reload 
Javascript :: how to reload webview in react native 
Javascript :: rest operator in javascript 
Javascript :: create file node 
Javascript :: curl to javascript fetch 
Javascript :: discord message reply 
Javascript :: React Redux store exemple 
Javascript :: button is not calling js function 
Javascript :: empty array length javascript 
Javascript :: graphql json schema 
Javascript :: react map list render dictionary 
Javascript :: how to add a function in javascript 
Javascript :: post json array data curl 
Javascript :: npm mongoose findorcreate 
Javascript :: como ordenar um array em ordem crescente javascript 
Javascript :: javascript dom methods list 
Javascript :: JSON parse error: Cannot deserialize value of type `java.util.Date` from String 
Javascript :: linkedin api v2 get email address 
Javascript :: favicon express js 
Javascript :: how to print the error massege in js 
Javascript :: TypeError: Expected a string but received a undefined 
Javascript :: 35,2 + 29,4 
Javascript :: luxurious 
Python :: no module named social_django 
Python :: how to install matplotlib in python 
Python :: Import "reportlab" could not be resolved django 
Python :: how to print error in try except python 
Python :: jupyter notebook print all rows dataframe 
Python :: python if main 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =