#development
1 messages ยท Page 373 of 1
no i dont have a bot dev role @hushed oyster
so for example suppose I went
@earnest phoenix if you want to learn more javascript I suggest trying codecademy, there is a whole lesson on functions if you are having trouble
can somebody team me
let a;
a = function() {
console.log('Hello, world!');
}
a();
that would declare a variable a
i did code academy but i forget easily
then assign a function to it using a function expression
then it calls the function stored in a
you can also do the => method for functions 
instead of function
but thats something else
I'm gonna go eat dinner brb
mk
you can only use arrows on ES6 tho
and its confusing if you dont know what a function is in the first place
this is all i learnt from code academy:
msg.channel.send(`Hello there' + username + ', how are you?');
Output:
Hello there Hello, how are you?```
erm you forgot a lot then
ik but thats all i remember
that's not what the output would be
for one, it'd throw an error because you're opening the first string with a backtick and closing it with an apostrophe
and secondly you're missing a space between the first string and the username variable, so it would output Hello thereHello, how are you?
let = username = 'Hello' isn't even remotely correct
"hurr durr that's how it runs" smh
the correct way to declare the username variable would be let username = 'Hello';
hey be sure to explain the difference between let = username = "Hello" and let username = "hello"
nothing is learned if you don't explain
oof
also coincidentially let = username = "Hello" would probably actually do the same thing albeit only accidentially lol
I learnt by googling
anyways food time bye
@earnest phoenix try looking back on multiple codecademy lessons and try to study it
ill give you some money xD i clearly dont know how to code
yeh no I don't need the money
Donate the money or do something useful with it
wat
?
You don't need to pay to learn
๐
fuck

anyone know why the site interpreting my bot page's css as paragraphs? Every block looks like this:
<p>#menu {
background: transparent;
}</p>
it's in a style tag so I'm a bit confused
that could be
the first css block works fine and then everything else is a p tag
I'll try minifying it I guess?
wow, that worked
thanks for the tip
np, even though I didn't really give you anything I just told you what the problem likely was
sometimes that's enough
lavalink bahd
Hello
hi
okay so connection timeout
Yeah #memes-and-media is a bit too busy hahaha
and victor
you just swore
i can tell that they are both right, because as you'd know my bot does join the channel
and it's the client.player.join that is breaking right?
"blake your code sucks" yes i know ill fix the console.logs later
well
thats the part i dont really get
in queueMusic
it never gets to that final console.log
so the promise is just indefinitely stuck
timed out
Where'd you get sandysounds
Alright
sanddyyy cheeks

discord.js latest master
oohhhh
๐ค
yes
you know how many times ive transfered Lavalink.jar in and out of my vps today?
its been torture
hmm
if you look at the code for pendingGuilds
can you try to find what its trying to do?
like if it doesnt timeout whats it normally supposed to resolve
It's a JS object
i know its an object
Hmm
4JR you use lavalink dont you
(ohh Keno is advertising on the radio)
๐ค
this.pendingGuilds[data.guild_id].timeout is all I see that references it
hey can you guys link me to where you get lavalink files?
and ```
clearTimeout(this.pendingGuilds[data.guild_id].timeout);
this.pendingGuilds[data.guild_id].timeout = null;
what's lavalink
its like fredboat or something
yeah
that will definitely happen
tnx'
after 10000 ms
but within those 10 seconds
f (this.pendingGuilds[data.guild_id] && this.pendingGuilds[data.guild_id].timeout) {
clearTimeout(this.pendingGuilds[data.guild_id].timeout);
this.pendingGuilds[data.guild_id].timeout = null;
}
That clears it
something is supposed to happen
voiceServerUpdate is supposed to be called
its not definitely supposed to happen, if its resolved within the 10 seconds it will be cleared
did it?
Yeah that's what I'm trying to find now
im not sure
I can't see any references to it
After doing a search in the repo
I can't find any references to voiceServerUpdate
doesn't seem so
i dont think so?
im not sure though
should i try it? it takes a "data" parameter but im not sure what thats for
๐
thats not the same
d
what's lavalink @austere meadow
its a link thats lava
lo
do you actually not know what it is
Nah I can't see anything that it uses which isn't given in that payload
@austere meadow How did you tap into the WebSocket connection?
on d.js?
well, i don't make jda bots
Yeah
@low rivet i thought you used lavaplayer or something similar though
nope haha
huh okay sorry
its basically like ytdl-core but a lot better
^
it includes more options and its based on Lavaplayer
made in java
which is faster
here we go again ;-;
I'm always right ;)
wait what
How did you tap into the WebSocket connection?
you guys found solution?
oh
https://please.zbot.me/1PjTpsuz.png
in lavalink.js (the one i used before and was working), it includes an onRaw function, and there is where voiceServerUpdate is used
its not certain
but it would make sense
Hmm
SandySounds doesn't include an onRaw thing
cool i might try it out zblake
im not sure if theres an equivalent
How did you tap into the WebSocket connection?
always wanted to make music but never had the time 
Wasn't there like an object where d.js would let you read the raw data it received from the WebSocket?
Ahh that's not on the docs
yeah
No problem man :)
blake you fix it?
oof
im not stable
kek same
Am I allowed to use am:exec here?
Alright
Actually
I think I found the source
oh ๐
You don't want to send
what do i want to do then
Receive
oh
๐
yeah thats the raw event i was talking about
Alright
basically just sends whatever it is thinking at that moment
I need to figure out what this packet is
Can you connect up to the raw event and tell me what you get?
I think that's just what you need
oh are you talking about the data parameter for voiceServerUpdate?
or the d parameter when sending the packet?
because you want to pass the d parameter to voiceServerUpdate
basically there is a lavalink packet that is separate, it looks like this;
{
"op": "play",
"guildId": "...",
"track": "...",
"startTime": "60000",
"endTime": "120000"
}
that is different to the discord packet
alright ill try it then
cant i just hook it up to my voiceStateUpdate event?
ok
i dont really understand still why you need this information
you know what its receiving
its that packet on the docs
thats what it gets
isnt it?
yeah
So maybe lavalink is supposed to send that
๐ค
HEH
oof
https://please.zbot.me/fsB6LnwQ.png
when it connects, its supposed to send a voiceUpdate
we are closing in on the issue
this is either a fault in SandySounds forgetting to handle the voiceStateUpdate event and passing it to lavalink, or something else
no that was in sandysounds
Oh ok
Player.js
theres 3 files
SandySounds.js is the equivalent of lavalink.js's PlayerManager
๐ค ๐ค ๐ค
i wouldn't think so
ok
this has to be it
the issue is that voiceServerUpdate is never called
thats the underlying issue
because the only way for that timeout to be cleared
is through that function
Yes
and without that, we can't pass
so essentially, the connection works, but the timeout is never cleared because... ?
im not sure why its never called
And voiceServerUpdate is supposed to be called by lavalink
i dont know if we have to manually call it
but lavalink is never informed of the voice server update
yeah
what
try what
Okay
So
In SandySounds.js there is a nodeCreate event
Please connect to that event
It takes one argument called node
but
ok
Tap into the raw event of d.js
https://please.zbot.me/Vb0Bd9xH.png
i was just going to explain that if i provide a nodes array, then it will automatically do that
okay
VOICE_SERVER_UPDATE
ah okay
t == "VOICE_SERVER_UPDATE"
ok
@austere meadow Got the d object?
one sec
๐
๐
okay
Great
So with the letter between s and f on the QWERTY keyboard object
(since some people have a strange mind)
For each node in SandySounds
maybe you put VOICE_STATE_UPDATE in op?
Send the letter between s and f on the QWERTY keyboard object
Oh and also set letter between s and f on the QWERTY keyboard.op = "voiceUpdate"
oh
according to the docs ๐
d.op = "voiceUpdate";
for each node {
node.send(d);
}
pseudocode!!!
im assuming i put that in the raw event
i cant filter it for some reason?
What?
async run(data) {
console.log("t")
if (data == "VOICE_SERVER_UPDATE") {
t gets run but the if statement never does
if (packet.t == "VOICE_SERVER_UPDATE") {
//do stuff
}
oh
thanks
if (data.t == "VOICE_SERVER_UPDATE") {
data.op = "voiceUpdate";
for (let i in this.client.player.nodes) {
console.log(this.client.player.nodes[i])
this.client.player.nodes[i].send(data)
}
}
not having great success
still getting timed out
thats probs wrong tho
i feel like you are getting the lavalink packets mixed up with discord ones
No I'm sending the voice server update to lavalink
Blake
You want data.d
not data
data.d.op
send(data.d)
data.t == ""
Yes Blake, I am taking Discord's packet and sending it to lavalink so it can turn it into a lavalink packet @austere meadow
lol
@austere meadow Did you get it?
trying to loop through a js map?
I have created a WIP Bot called BubbleBot.
ok
@austere meadow what you trying to do lol
honestly i have no idea lmfao
relatable
@white blaze client.players.nodes is a map
https://please.zbot.me/uO7SmQe4.png
looks like this
appears to map hosts to Nodes?
yeah
I'm looking for a good programming language for Chromebooks, but there seems to be none!
lolwhat
Yes, I use a Chromebook.
well that's your answer
there really are none
you can try running a secondary OS using crouton, however
@white blaze im gonna have dinner real quick then come back to this
im 99% sure this is a fault in SandySounds because theres just no sign of it passing voiceServerUpdate anywhere which is crucial to prevent that timeout
Want me to do this?
@austere meadow Alright
let event = data.d;
event.op = "voiceUpdate";
for (let [key, node] of client.players.nodes) {
node.send(event);
}
Try that

@white blaze i got cant get guildId of undefined but im also probably doing it very wrong XD
no no it says guildId not found
ok
Hmmm
let event = {
op: "voiceUpdate";
guildId: data.d.guild_id,
sessionId: something
event: something
};
for (let [key, node] of client.players.nodes) {
node.send(event);
}
Hmmm
ok
Prizes of $0 go to whoever can figure out what sessionId and event is
Hmm
I'll take a look in a couple hours
Bit busy now hahaha
Sorry
Thanks :)
np
client.on("raw", packet => {
if(packet.t === "MESSAGE_DELETE") {
let messageID = packet.d.id;
let channelID = packet.d.channel_id;
console.log(packet.d.id);
}
});```
dats how i made my logs. . . I need help with detecting the person who sent the message and getting the message so i can send a embed to like a [#logs](/guild/264445053596991498/channel/264889891039608874/) channel
welp i cant get it to work
Im using this as delete message log @earnest phoenix I like variables so... ```js
module.exports = function({DBM, Actions, Files, Events, tempVars, serverVars, globalVars}, client){
// can put custom stuff that doesn't work properly in run scripts here!
client.on("messageDelete", (message) => {
const content = message.content;
const author = message.author.tag;
const channel = message.channel.name;
const embed = {
"title": "Message from " + author + " removed",
"description": content,
"color": 9902553,
"footer": {
"text": "In: " + channel
}
};
message.guild.channels.find('name', 'bot-log').send({ embed });
});
}
Ah lol. I only read that you are looking for a delete message log...
this is just so odd because it worked fine for me in lavalink.js (d.js port of eris-lavalink) on lavalink 1.3
ikr
@austere meadow Again I think lavalink calls the update function directly
But I might be wrong
im honestly not sure :/
:|
@earnest phoenix do your friends also use SandySounds?
or do they use another lib?
hmm
@hushed berry You're the groovy master, what do i do? https://im.going-g.host/sxujCSNU.png
hmm
Hmmmm can anyone help with a deathbattle system (discord.js)
@quasi sandal more context pls @quasi sandal
@hushed berry i found the issue, I was putting a new line in a string instead of using \n
Oh like the actual character?
@earnest phoenix https://github.com/MrJohnCoder/SandySounds/issues/18
concluding the problem to an issue in SandySounds or lavalink, both yours and my code look correct, ive adapted changes and done everything i can, but it's still failing. im hoping john can give a speedy response to help us solve this
Is there any possible way. . . to make a timer in discord.js?
Like a countdown command
you can use setInterval with a 1000ms delay
that'd be the easiest way
if you want seconds ofc
well. . . i was thinking of dat but i ended up figureing out how to execute it
exports.run = (client, message, args) => {
let member = message.mentions.members.first();
let guild = message.member.guild;
let Role = guild.roles.find('name', 'Muted');
if(message.member.roles.has(config.botcommanderRole)) {
member.removeRole(Role);
message.member.send(`You have been unmuted. If you break a rule again the mute will last longer! Be carefull!`);
return;
} else {
message.channel.send(`Only people with \`bot-commander\` role can use this command`);
return;
}
}```
why does it send a message to me and not to the person i mentioned
Hi
it allows us to get the Guild information back that the user added our bot to so the web site can save record of our bot having been added to that server
I don't understand why you can't do this via a webpanel if the user requests to do so
Me and Ken seem to be a bit confused about your issue seeing as it's quite uncommon.
@languid dragon We require only the administrator of the server, the one who added the bot, to login to our web site to configure the bot.
But why can't you do that using commands?
And why can't you make the user Oauth to your website
instead of when you add the bot
it's easier that way
big bots do it like @jolly zephyr is a prime example
It's very possible using commands - but you're asking for a full rewrite of our application. Our "bot" only exists to show an "Active" indicator in the online list. Everything else is done via the web site and webhooks. We aren't your average bot, because we've built a web interface for configuring rather than a bunch of commands.
I need to attend to my daughters, be back in a few
Okay Ben we dont ask you to rewrite your application rather then your bot isn't passing our standarts and you want to submit it here, you can also just let your bot like that and not submit it ๐
who rejected the bot
because this is not a case of some idiot just toggling the grant code option with his application
uhh i think it was loris
1 sec
It's not my objective to get anyone in trouble or anything of that nature, I'm sure you guys get tons of spam and this is the right call 99% of the time that you see it.
@median dragon have you resubmitted your app?
we just found the site of your bot, did you link that on your bots profile while submitting?
๐
Yes. The description CSS is a bit dated, my partner is asleep atm and he has the latest version
Yes, we did link it.
@median dragon We'll get back to you in a few moments, thank you for your patience!
No problem, thanks for taking the time to dig into this for me.
@austere meadow anything worthy yet?
did you see the link i mentioned you
hold on
https://github.com/MrJohnCoder/SandySounds/issues/18
basically all i got so far
ive been checking source code and stuff
can't find much unfortunately
do you know how to get in contact with john?
the creator of sandysounds
no ๐ญ
rip
yeah im a bit upset tbh, i was hoping to get it working tonight but no luck at all
100% its an issue with sandysounds tho, i have checked top to bottom for issues and came up with nothing
so im just waiting to see what john will say
inb4 its 100% your fault
it probably is
but im open to that
@fleet mason u use message.member just use member :/
can anyone help me? i am trying to detect how many users reacted ๐ and also counting how much users reacting ๐ and see which one has more
I just read the tutorial in #announcements to see if theres something interesting and just read that i shouldnt save data in jsons. I thought json databases are good?
hello
TBH I only work with SQL so I can't really help you much there
I dont know sql nor nosql right now ๐คท
@edgy vale You might want to look into, MongoDB or rethink DB
Cause i need it just for balances and general server settings
Bad practice to put function definitions inside a C++ header when working with templates?
pls someone tell pls how to. . . detect the reactions in js
I think implementation in headers can cause circular dependencies more easily
yeah but doing templating in .cpp files is insanely ugly in my experience
Hello, I use d.js and I cant get a message delete event going, I want to get it to log to a channel but this code doesnt seem to work
hm
client.on("messageDelete", msgs => {
msgs.forEach(msg => {
msg.guild.channels.find("name","server-logs").send("Message delete test");
if(msg.channel.name === "daily-advertisement") {
msg.channel.overwritePermissions(msg.author.id, {"SEND_MESSAGES":true});
}
});
});```
IVe tried bulk also but
@earnest phoenix so in short my bot checks the reactions of the message after a min. message.reactions returns a reactions list in python. Then i go through each reaction and if its an emoji i want, for example a ๐, i then count the number of reactions it has on the message reaction.count and save that to a variable
Anyway
the messageDelete event gives you a single message, not a collection @earnest phoenix
huh
@tawny lava wasnt the prolem
that's not the problem right after the start of the event we do console.log(1) and it doesn't respond in the console
Exactly (btw goldensaur is helping me)
@edgy vale my question is how do i do it in js :/
check the docs on how to get the reactions of a message
then check the docs on how to count reactions of a kind on a message
๐ค i cant rlly find it
Anyway, mention me or goldensaur if you have a fix, thanks!
@earnest phoenix you didnt even look ๐คท
https://discord.js.org/#/docs/main/stable/class/Message?scrollTo=reactions
https://discord.js.org/#/docs/main/stable/class/MessageReaction?scrollTo=count
Discord.js is a powerful node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
ty i just figure it out
If you update your bots avatar It will update on the site I'm pretty sure @glossy junco
Applying for cert and being approved
kk
how can i make my bot delete the message that the bot sent after 10000ms?
async future method
I don't know what language so I can't tell you what you can use
But basically just assign a method that runs 10 seconds in the future
d.js
uhhh setTimeout? (lol I only know JS with browsers)
setTimeout works in node too
So nobody found the solution to my problem
Even though
there are over 100 developers who know
the messageDelete event emits a single message, not an array of them
but im noob, how can i make it delete the bots message lol
Store a reference to the message you sent?
I assume the library would work similar to what I use
myMsg = await channel.send("stuff")
setTimeout(()=>delete myMsg, 10000)
thanks
do note that that's pseudocode and you can't just copy+paste it with the expectation that it will work
@austere meadow hey i think i figured out the issue
Does anyone know how to add {ping so it returns with the ping of the bot? I need help with it in JavaScripts (Discord.js)
client.ping or client.pings
kk
<client>.ping
But why 
hi
holla for the discord.net people????!!!!
discord.js ๐ฆ
@earnest phoenix really did you get it going
holy shit how
the only thing i had to do is change my client.player.join()/.leave() to client.joinVoiceChannel() / .leaveVoiceChannel()
on sandysounds?
eris-lavalink
it looks like sandysounds doesn't handle sending the op 4
yea
what lib are u using
d.js
Hey can any C# Botdev recommend an ORM for Postgressql? 
@restive silo was poking for a bit, found https://github.com/tumtumtum/Shaolinq
events.js:143
throw err;
^
Error [ERR_UNHANDLED_ERROR]: Unhandled error. ([object Object])
at Client.emit (events.js:141:19)
at WebSocketConnection.onError (C:\Users\JMasher\Desktop\Discordjs\MashBot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:371:17)
at WebSocket.onError (C:\Users\JMasher\Desktop\Discordjs\MashBot\node_modules\ws\lib\event-target.js:128:16)
at WebSocket.emit (events.js:160:13)
at WebSocket.finalize (C:\Users\JMasher\Desktop\Discordjs\MashBot\node_modules\ws\lib\websocket.js:190:41)
at TLSSocket.emit (events.js:160:13)
at emitErrorNT (internal/streams/destroy.js:64:8)
at process._tickCallback (internal/process/next_tick.js:152:19)
C:\Users\JMasher\Desktop\Discordjs\MashBot>pause
Press any key to continue . . . here is my error
are you using pc or laptop
i dont think that matters lol
well, kinda
handle errors
if you close your laptop it can shut off your wifi and return that error
ยฏ_(ใ)_/ยฏ
@subtle ferry and also you need to show code, we can't help you with only a vague error
dude
listen to what other people say
he should handle the error event of every EventEmitter
atleast with a console.log
^
Does anyone know how to automatically add person to a role upon entering a server with a bot?
cant find the doc to do so
What programming do you use?
js
๐ค
@twin quartz in your member join event use addRole
yes
Thanks
anyone know any good tutorials for jda command handlers
jda utils
For some reason I keep getting the
(node:11572) DeprecationWarning: TextChannel#sendMessage: use TextChannel#send instead
error
channel.sendMessage("x") -> channel.send("x")
I was doing the !ping command with the response "pong".
ok
Kinda weird how it never showed up until now
How to reduce memory usage in python
best method: use js use tabs
its a joke
And By the way I dumped
does anyone know if ffmpeg stops ytdl shit from working cause on my test bot my music feature works and on the main it doesn't, I have all the packages updated and are exactly the same as on my test bot, the only difference is that I have ffmpeg installed, so was wondering if that could be what's causing the bot to leave instead of skip to the next song in the queue.. and yes, the code is all correct.. I've triple checked. I do get an error in console.. but it doesn't actually say what's wrong.. it just says: "user" and on another line it says "undefined".
I've been trying to fix this for a week... smh.
can u give me the whole console error?
yeah but why would I get that error if its working on my test bot? I looked at all my variables and they all seem fine.. @prime cliff
how do i get a PY bot to Execute code in a specific order
idk
how do i make it so if the user reacts to one message then it gives them permissions,
Current Code:
```Shrug.on(messageReactionAdd, (messageReaction, user) => {
console.log(messageReaction);
const msguser = messageReaction.users.forEach(user.id);
msguser.setPermissions({
SEND_MESSAGES: true,
READ_MESSAGES: true
}).catch(console.error);
})```
but that doesn't work
because you can use .setPermissions on a member and you would normally just create a role what is assigned on a GuildMember
i have a idea sec
@earnest phoenix use a database
@earnest phoenix user.id isn't a function, passing it into .forEach isn't right
well fuck
ok
like wat thou @uncut slate
I am blank
MySQL?? idk how to use it. . .
rethinkdb i also idk how to use it
like whatever you want, Google around the subject and pick something you like.
yeah lmao, you're not just going to know how to use a database when you wake up
you'll have to learn
I wouldn't suggest MySQL personally though
rethinkdb is good for learners
mongodb
mmmmm
ok i will google rethinkdb
oof
I was told to use .json files for my censor bot, the file contained all the banned words....
but when i did it with the json file it deleted EVERYTHING instead of just the words...
hmm
how did you format the json
you might want to delete that
do you know how to make a javascript array
not really.... ๐ฎ


i was told that the way i have it now would work tho ๐ฎ
Discord has spelling control now ?!?
why does everyone I talk to about arrays end up not knowing what they are..
@deep parrot you can turn it off
But where tho
so... how do i do this "array" if the mod who told me to do it how i have it now is wrong
wait... i think i messed it up actually
nope
i did it right
it just, doesnt work
@trim plinth do you have any suggestion on js array tutorials
oh nvm
i do know what a js array is xd
try putting something in it, see the output
alright
i see now i put my regex expression in there
alright i got the whole new RegExp(str)...
but now, where do i actually put it
what are you trying to accomplish anyways
cause it not working in json file
im tryna organize my stuff better
I have a censor bot
and i want a variable that has all of the words
why use a regular expression then
if you're just matching against a huge word list, regex is inefficient
idk any other ways :/
use. . . something like
exports.list
google "fuzzy string search" or something along those lines
the regex doesnt actually work with a variable in another json file
and i would store your word list as an array of words
since that's kind of what arrays are for
storing... multiple of something
wait. . . so u are trying to make a bot. . . dat deletes bad words?
you could just not use regex lol
but i wanna organize it better
what if i say something like "fvck you!"
then i could add that too the wordlist i guess...
it's not really effective
but idc really
oookay
my anti-swear systems does this. . .
exports an array of bad words
goes thru the sentence and finds bad words like
fuck. . . because i go thru the sentence not per-word it can detect stuff like fucku
soooooo goooglle for lyfe
well if you really insist on doing this regex thing
u could just do it with pure js. . .
thats what i am doing rn
you should store the patterns as strings and deserialize them to regexes when you load the config
but i have to edit every single part when i find a new word
wat u mean find a new word?
like "fvck" for example
there are an effectively infinite number of variations though
But the problem is that i have 3 seperate parts. 1: normal message censor 2: edited message censor 3: guildmember nickname censor
well if you're having so much fun with regex why not use one pattern for all three subsystems
well. . . there is legit infite ways to say fuck. . . like uck fck fuck fuc fuc
i understand that, but it's just to stop the common person i guess
anti-swears cant be perfect
fucAAc
also, im not talking about bypassing here
bypass done
memes
im talking about what ํฌํ with having three different regex's off of one pattern
which i dont know how to do, which is why i came here
why in the world do you need three regex objects
make one and reference it in all your different subsystems
you do it by... not making three?
xD
i don't honestly know how to make this more clear
same
I can't just "not make it three"
or else only 1 part would work
how would i make a variable or something, that i can just put in each of the regex lines, and it all has the same words
...
- ur code isnt efficient because it gets only 1 type of channel. . . u should use .find u find a channel not send it to a channel with a id
- check ur dm
ik but it isnt efficient to do this bot.channels.get("399688995283533824")
talk all the shit u want about my logchannel, idgaf
that's not what im here to get help with
calm
it is advice
He's just trying to help you
ok let's think about it like this
what you have right now is something like
const words = /* something */;
function subsystemOne() {
const regex = new Regex(words);
// do other stuff
}
function subsystemTwo() {
const regex = new Regex(words);
// do other stuff
}
function subsystemThree() {
const regex = new Regex(words);
// do other stuff
}
what you need to do is extract that regex variable to a higher scope so all three subsystems can reference it simultaneously, right?
w0t we do
so why not do something like
const words = /* something */;
const regex = new Regex(words);
function subsystemOne() {
// do stuff with regex
}
function subsystemTwo() {
// do stuff with regex
}
// ...
can I halp too
ooh. . . i know wat he means by make it more neat. . he is doin
if (message.content === "fuc") { //stuff}```
what isnโt true
and message.content.match
L39
wait no wtf
you're doing require('./words.json') but you don't do anything with it?
hi stay out of this channel if you're not helping and don't need help
ive been trying to do that
but it's not been working
just ignore that
it's not in my actual code
like i tried to use the words.json (words.words) in the regex line
but NO SPOON FEEDING
but it doesnt like it
i even hv a github repo for it :/
I dont wanna be spoonfed
i know. . .
that's probably because you don't have a field called "words" in your words.json
if i wanted to just make a discord bot i would've done it already in java
i mean words.bannedwords
well you've surrounded your pattern with /.../gi
that's only regex literal syntax, right
not part of the pattern?
shit
Phanta can u check ur dm?
welp
and tell me wat u think
i'm busy
๐ฆ mkay
๐
wait can i add /words.bannedwords/ in the regex
i'm in class right now actually but I feel like I'm committed to helping this guy with his thing
or will it just scan for "words.bannedwords"
no no no jesus christ
oh ok
ok so when you go /something/gi
you can but you really shouldn't
it creates a regular expression with the pattern something and the flags gi, right?
ye
are u telling me dat u want a file for the bad words?
this is a regex literal
it's identical to going new Regexp('something', 'gi')
where the first parameter is the pattern and the second is the flags
which is what i did before
but that wouldn't work because your something is of the form /abcdef/gi
so it's matching for a string delimited by slashes with gi on the end
i guess ye
which is obviously not what you want, right?
ye
so the logical conclusion is...?
not to do that? idk, what you're really trying to get me to understand
yes
explain
an exact value?
what in the world is that supposed to mean
I contend that you have no idea whatsoever what a literal is
no
I recommend you start relearning JS (possibly another language that fits you better) from the base
you seem to have issues understing core concepts
@uncut slate Nvm, i figured out how to do it, one problem is how do i add my flags to the regex statement... if (message.content.match(bannedwords)) {
i need flags gi
but idk where I'm supposed to put them ๐ฎ
how are you defining bannedwords
that's just a string
how do i embed? :(
what lang
jus
jus?
jay ess
lib?
js
d.io
@earnest phoenix
is on msg and the other message? @quiet bobcat
?
idk
What library
js
discord.js
Ok
you can do channel.send({embed:{/* embed obj here*/}})
Or just look at this tutorial
https://anidiotsguide_old.gitbooks.io/discord-js-bot-guide/content/examples/using-embeds-in-messages.html
or that :/
for the objects aswell
code?
you have to replace channel with your channel obj so like message.channel or something like that then you have to add your embed fields. or you can use the djs rich embed builder thing
something tells me this is not gonna work https://did-you-know-that-the-last.letters-of-the-alphabet-are.xyz/ln8BvRkN.png @quiet bobcat
it will
thats not hex
isn't it?
rgb int




