Discord.js Bot Development - Clear and Say Command - Episode 13

Discord.js Bot Development - Clear and Say Command - Episode 13

{TheSourceCode}

6 лет назад

54,922 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@fishls8374
@fishls8374 - 06.08.2020 08:49

This is very helpful:))

Ответить
@kyvoi9729
@kyvoi9729 - 23.07.2020 15:45

HELP ME PLS WHEN I DO !say THE BOT DOES NOT SAY I DID THE EXACT SAME THING HE DID

Ответить
@sampyt4005
@sampyt4005 - 17.07.2020 14:35

THANKSSS

Ответить
@dualfennecfox6569
@dualfennecfox6569 - 22.06.2020 04:24

oof

Ответить
@j4mess
@j4mess - 22.05.2020 10:57

I dont understand lmao

Ответить
@maddsub7108
@maddsub7108 - 19.05.2020 16:23

can you make like lets say mee6 delete its own message in DM's

Ответить
@flaregun3547
@flaregun3547 - 30.04.2020 16:45

If that didn't work, you can only paste this:


case "Say":
const Embed = new Discord.MessageEmbed()
.setColor(0xFFC300)
.setTitle("You have to text your message!")
.setDescription("You can make me say everything!");

if(!args[1]){
message.channel.send(Embed);
break;
}

let msgArgs = args.slice(1).join(" ");

message.channel.send(msgArgs).then(messageReaction => {
message.delete(1000).catch(console.error);
})
break;


"You have to text your message!"
"You can make me say everything!"
"0xFFC300"
Theese can be changed, text me if you have a problem: ♥☆𐌀𐌊𐌆𐍂𐌀☆♥#2834

Ответить
@gylp7950
@gylp7950 - 27.04.2020 01:44

Error: Cannot find module 'C:\Users\tarik'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:973:15)
at Function.Module._load (internal/modules/cjs/loader.js:855:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}

Ответить
@benasquith8457
@benasquith8457 - 22.04.2020 14:21

message.channel.bulkDelete doesn't work any more any ideas why? it says the message bust be a array, collection or number?

Ответить
@rock9009
@rock9009 - 02.03.2020 00:28

it's good but, how can I make it exact like if I type in clear 10 it will only clear 9 messages including mine I just typed

Ответить
@cryb4byhayden191
@cryb4byhayden191 - 31.01.2020 18:13

where to code-

Ответить
@albert.thefreak
@albert.thefreak - 25.01.2020 19:28

Error: Cannot find module 'C:\Users\tarik'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:973:15)
at Function.Module._load (internal/modules/cjs/loader.js:855:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}

Ответить
@lordszebol8019
@lordszebol8019 - 06.01.2020 07:10

i need do it on certain channel how to do it?

Ответить
@raik1766
@raik1766 - 02.11.2019 01:04

if(!message.member.roles.find(r => r.name === "Admin")) return message.reply("Sorry, you dont have permission to clear the chat");
        if(args[0]) return message.channel.send("you need to specify a number");
        message.channel.bulkDelete(ars[0]),then(() => {
        message.channel.send(`Cleared ${args[0]} messages`).then(msg => msg.delete(2000));

"you need to specify a number" what a shit

Ответить
@andrewchu6370
@andrewchu6370 - 14.10.2019 02:33

So here's my problem.. When I say "?say test" my bot literally says "says test". Someone help..?

Ответить
@spaceartsar9197
@spaceartsar9197 - 29.08.2019 12:44

"The messages must be an Array, Collection, or number."

Ответить
@XMOHAMX
@XMOHAMX - 10.08.2019 22:47

Hmmm.... How can I set a timer! Like... Letting it saying something by itself every few minutes.. without commands!?

Ответить
@shikiosstickmen3932
@shikiosstickmen3932 - 09.08.2019 22:33

Thanks so much! I'm terrible at coding and I have attempted to learn it, but I kind of have a problem with remembering things, so programming never got a reality. I followed the Discord.js guide and managed to create a working command, but I was on my own from there and wanted a Say command, so thanks.

Ответить
@th0maas748
@th0maas748 - 26.07.2019 18:42

my bot won't start op and says message not defined. can someone help?

Ответить
@bossmusa9075
@bossmusa9075 - 23.07.2019 21:53

Not work :




C:\Users\AIHAN.1\Desktop\Discordjs2\tutorial>node index.js
{ [Error: ENOENT: no such file or directory, scandir 'C:\Users\AIHAN.1\Desktop\Discordjs2\tutorial\cmds']
errno: -4058,
code: 'ENOENT',
syscall: 'scandir',
path: 'C:\\Users\\AIHAN.1\\Desktop\\Discordjs2\\tutorial\\cmds' }
C:\Users\AIHAN.1\Desktop\Discordjs2\tutorial\index.js:8
let jsfiles = files.filter(f => f.split(".").pop() === "js");
^

TypeError: Cannot read property 'filter' of undefined
at fs.readdir (C:\Users\AIHAN.1\Desktop\Discordjs2\tutorial\index.js:8:25)
at FSReqWrap.args [as oncomplete] (fs.js:140:20)

C:\Users\AIHAN.1\Desktop\Discordjs2\tutorial>

Ответить
@mxrage909
@mxrage909 - 15.07.2019 00:21

anyway to make it clear msgs from only 1 user? like filter whos msgs it deletes

Ответить
@davidmayr4540
@davidmayr4540 - 29.06.2019 23:03

How can i filter out pinned messages?

Ответить
@quhaso
@quhaso - 03.06.2019 12:08

Amazing, I did it succesful !!!, THANKS

Ответить
@koolooberyded2463
@koolooberyded2463 - 01.06.2019 22:55

Where do I put the code? How do I apply it to discord?

Ответить
@AyameTenchu-cg2ox
@AyameTenchu-cg2ox - 25.04.2019 02:25

ReferenceError: args is not defined

Ответить
@8DaMusic
@8DaMusic - 21.04.2019 12:59

how do i join your discord server

Ответить
@imf5326
@imf5326 - 12.04.2019 02:18

what is the token.json

Ответить
@noobphantomgirl5479
@noobphantomgirl5479 - 29.03.2019 12:26

you change your desktop background
last time it was.... :>

Ответить
@GeoBaer
@GeoBaer - 02.03.2019 15:01

About the Clear Command: you have to check if the messages above are older than 2 weeks, or if the number is over 100

Ответить
@ronitabonita3020
@ronitabonita3020 - 02.03.2019 12:12

All the commands stops working after a while. Wtf i dont get it.
I had to do redo the bot from scratch 2 times already

Ответить
@heriyadibukit3787
@heriyadibukit3787 - 17.02.2019 23:12

(node:5792) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'member' of undefined

Ответить
@qidn7775
@qidn7775 - 08.01.2019 16:43

Okay so, were is your prefix?!

Ответить
@shadyplayz5062
@shadyplayz5062 - 13.12.2018 09:03

Add ANIME commands

Ответить
@MegaMix_Craft
@MegaMix_Craft - 30.09.2018 20:34

clear command not working

Ответить
@koareta1210
@koareta1210 - 23.09.2018 23:06

When i run the command, nothing happens, even though it says no problems, can i get some help please (im using VSC)

Ответить
@OfficialRDB
@OfficialRDB - 16.09.2018 16:01

It doesnt seems to work when i do. !say !warn @user reason
Can my bot not use that command ?

Because the warning works great.
I have a wordfilter build in and some other things, i like to warn people after the failt on them.

I just want my bot to do that.

Ответить
@poss9234
@poss9234 - 08.08.2018 21:58

your bot cleared only 3 messages, yet you had the command to clear 4.. how do you fix this?

Ответить
@zyco3914
@zyco3914 - 16.07.2018 16:23

Ive a problem:
let botmessage = args.join(" ")
^

args is not defined

Ответить
@dereksupathicc8381
@dereksupathicc8381 - 16.06.2018 10:38

uh. where do i code this???? im so confused

Ответить
@nociak3386
@nociak3386 - 08.06.2018 15:52

and for people who put everything in the index.js using the code:
if (message.content === prefix + "command") {

I tried but do not want it ..
how's that?

Ответить
@miningllama5097
@miningllama5097 - 17.05.2018 04:10

Wait: How do you make it say No. on the say command if the user does NOT have MANAGE_MESSAGES?

Ответить
@gmsgms8823
@gmsgms8823 - 29.04.2018 01:49

I want to add code mention , ex : !credit @user

Ответить
@gmsgms8823
@gmsgms8823 - 29.04.2018 01:41

.

Ответить
@directedbyturkiye6463
@directedbyturkiye6463 - 08.04.2018 16:00

if(!message.member.hasPermission("MANAGE_MESSAGES")) return message.reply("off.");
if(!args[0]) return message.channel.send("off");
message.channel.bulkDelete(args[0]).then(() => {
message.channel.send(`Cleared ${args[0]} messages. `).then(msg => msg.delete(5000));
})
}

Ответить
@Littletsu
@Littletsu - 06.04.2018 02:28

Thanks it helped me so much

Ответить
@seth4452
@seth4452 - 01.04.2018 04:59

Instead of it being like,
Me: !say Hello
Bot: Hello
It keeps on doing this
Me: !say Hello
Bot: !say Hello
And the bot keeps on deleting and repeating !say Hello

Ответить
@mikkeljohnsen4170
@mikkeljohnsen4170 - 26.02.2018 01:01

Hey nice vid man! Could you make a video about how to set the bots status like dnd, idle or invisible 😀 that would be cool

Ответить