#development
1 messages · Page 846 of 1
a part of the token is actually just a timestamp
only the timestamp part changes
the actual token doesnt
anyone know if its possible to use permissionsOverwrites on a channel based on a users permissions
i.e a user with KICK_MEMBERS can see the channel however without, they cannot.
[djs]
the token will still work regardless of the changes of its timestamp component
ow
@earnest phoenix the only way is to use roles
yeah thought so
give the user a role with kick_members and put the role in the channel's permission overwrites
thing is I want it to be sorta globally working, cus some servers mods will be named "mods, moderators" etc.
you can search for all roles with kick member permission and add them all to the channel
you can loop over roles in a guild and check if role permissions contain kick members
for example (v12) js let roles = guild.roles.cache.filter(role => role.permissions.has("KICK_MEMBER"))
if (resolve[1] != null) {
getPlayers(758071, 4585176).then(function(resolve) {
if (resolve[1] != null) {
getPlayers(758071, 4585176).then(function(resolve) {
if (resolve[1] != null) {
//YOU GET THE IDEA
} else {
//DO ACTION
}
})
} else {
//DO ACTION
}
})
} else {
//DO ACTION
}
})```
How can I automate this so it isn't hardcoded?
sorry if I'm asking too many questions, and you don't have to give the code for this but, how exactly would I add "roles" to the permisisonsOverwrites.
what is the difference between each nested function?
well, at some point the function will return resolve[1] which isnt gonna be null
and i want it to keep running until it does that
a while loop
uhhhhhhhhhhh
inside the first function
ah crap
@earnest phoenix
@earnest phoenix why is the result of the function gonna change over time?
alright perfect, thanks for the help!
what exactly is the function doing?
@quartz kindle oh crap i forgot something in that example code
var currentArray = []
return new Promise(resolve => {
var url = `removedbecuznotneeded`;
if (cursor) {
var url = `removedbecuznotneeded`;
}
fetch(url)
.then(res => res.json())
.then(jsonData => {
jsonData.data.forEach(element => {
var pushTo = element.username + "(" + element.userId + ")"
currentArray.push(pushTo);
});
var resolveMe = [currentArray, jsonData.nextPageCursor]
resolve(resolveMe)
});
})
}```
so it should use the new resolve[1] (nextPageCursor)
in each of those nested
ah so each iteration can only resolve a part of the data with a cursor
and you need to scan more parts
you can use either a recursive function or a while loop
i just dont know how to use a while loop with async
a while loop should work with async as long as the loop itself is inside an async function
async (whatever) => {
while(something) {
let a = await result()
}
}```
How can I access the bot-img class on the dbl bot pages
inspect it and see which class it has lol
@quartz kindle what goes in (whatever)
could I do async function getAllPlayers(group, roleId) => {
now the problem is, you need to be very careful
because while loops can easily lead to infinite loops
ok
var cursorNull = false
while(cursorNull == false) {
let curResolve = await getPlayers(group, roleId)
if(curResolve[1] == null) {
cursorNull = true
}
}
}```
so like that
then i can use the data
from curResolve
I mean you don't need => if you're using the function keyword
you can also use while(!cursorNull)
ok
SEND_MESSAGES: true,
VIEW_CHANNEL: true
})
Tim just wondering if I had done something incorrect here if you could point me in the right direction that would be great!
var cursorNull = false
while(cursorNull == false) {
let curResolve = await getPlayers(group, roleId)
if(curResolve[1] == null) {
cursorNull = true
}
}
})``` Isn't like that?
@earnest phoenix
nah UH
that leads to more errors
var cursorNull = false
while(!cursorNull) {
let curResolve = await getPlayers(group, roleId)
if(curResolve[1] === null) {
cursorNull = true
}
}
}```
that works ^
Oh yeah it's a function, alright ^
SEND_MESSAGES: true,
VIEW_CHANNEL: true
});``` @earnest phoenix
ah sorry, I took .updateOverwrites from the documentation, my bad.
Np, ^^
updateOverwrite does the same thing mostly
overwritePermissions is better if you're adding multiple users/roles
This is my code here, https://sourceb.in/7f7d38ebb5
it is allowing all users to be able to see into the channel, is this a problem due to the permissionOverwrites of when I create a channel?
this is very wrong @earnest phoenix
you probably want handleVideo() not handleVideo = ()
@earnest phoenix you can add the permission overwrites on the channel options, no need to add them after the channel is created
also
How can I get a bot to respond to a trigger word?
your "allowedUser" is a collection of roles
you need to add a separate permissions block for each item
alessandro, go and learn how to call a function
like he's supposed to respond to replaced
the word
Do I use it like the ping pong version?
@quartz kindle The code of alessandro isn't very similar to Cxllm who said that he made it by himself? x)
return new Promise(resolve => {
var currentArray = []
var cursorNull = false
var nextCursor = null
while(!cursorNull) {
let curResolve = await getPlayers(group, roleId, nextCursor)
length = length + curResolve[0].length
currentArray = currentArray.concat(curResolve[0])
if(curResolve[1] === null) {
cursorNull = true
}
}
resolve(currentArray)
});
}
why do i get await is only valid in async function
this is how i call it
console.log(resolve.length)
})```
is £ a common prefix? curious
fun
what program u using? to animate
look for box-shadow, should be in one of the img's parent elements
css
CSS I think
ah ok no idea how that works sorry
oh I was looking at the wrong class
#bot-details-page .bot-img {
box-shadow: none !important;
}```
yep
How long does it take for a bot to get ready? Like I'm on terminal
And my bot hasn't gotton ready at all
Its taking 5 of the forevers
what processor do you have?
ok do you know how to find the CPU you have?
no
top left, press the apple logo and press about this mac
then you can take a screenshot
it should only take a few seconds maybe 20 at max
it worked fine eariler
you didnt delete any code?
add this to the bottom of your code :
client.login(token)```
yeah Lol
Ok it works
I'm dumb sometimes
const playlistPattern = /^.*(youtu.be\/list=)([^#\&\?]*).*/gi;
i know this is wrong some plz help 
regex 101
I have never used regex's
How do I add new commands?
I mean like a trigger word
i was planning on my bot responding to the word replaced
?
wrong chat srry
oh
Anyways like I said I needed help with a bot trigger word
btw that's not allowed in this server fyi
if the bot is this server responded to words it will be mute
No in my own server
I'm trying to get him to respond to replaced
so for example u say replaced it will respond an msg yes @earnest phoenix
then do this
if (message.content === 'replaced') {
message.channel.send(`hello world`);
}}```
hmm
For some stranger reason he's not responding

are u new to this
yes
I'm used to coding ddlc mods
@earnest phoenix why make an async function tho
u don't need to i did that if he wanted to add more
So what do I do?
I literally am new to this
let me see your code plz
Ok
here ya go
one sec
k
vap ncs 24/7
strange your code is acting wrong
how?
no need to send your js file
you can paste your code here using code blocks
``` code here ```
yes we all need colors
colors make it 69% easier to read
Are iframes allowed in bot posts?
const Discord = require('discord.js');
const client = new Discord.Client();
const { prefix, token } = require("./config.json");
client.on('ready', async () => {
console.log("Ready!");
});
client.on('message', console.log);
client.on('message', message => {
if (!message.content.startsWith(prefix))
return;
const args = message.content.substring(prefix.length)
.trim()
.split(/\s+/);
const command = args.shift().toLowerCase();
if (message.content === 'replaced') {
message.channel.send(`What? Did you say the forbidden 'r' word?`);
}
switch(command) {
case "ping":
message.channel.send('Pong!');
break;
default:
break;
}
});
client.login(token)```
Epic
@tame shuttle yes
can I have colors?
const Discord = require('discord.js');
const client = new Discord.Client();
const { prefix, token } = require("./config.json");
client.on('ready', async () => {
console.log("Ready!");
});
client.on('message', console.log);
client.on('message', message => {
if (!message.content.startsWith(prefix))
return;
const args = message.content.substring(prefix.length)
.trim()
.split(/\s+/);
const command = args.shift().toLowerCase();
if (message.content === 'replaced') {
message.channel.send(`What? Did you say the forbidden 'r' word?`);
}
switch(command) {
case "ping":
message.channel.send('Pong!');
break;
default:
break;
}
});
client.login(token)```
u dont have to but way your doing it so uneasy
again
My code is wrong
yes
const Discord = require('discord.js');
const client = new Discord.Client();
const { prefix, token } = require("./config.json");
client.on('ready', async () => {
console.log("Ready!");
});
client.on('message', console.log);
client.on('message', message => {
if (message.content === 'replaced') {
message.channel.send('why did u say the r word');
}
if (!message.content.startsWith(prefix))
return;
const args = message.content.substring(prefix.length)
.trim()
.split(/\s+/);
const command = args.shift().toLowerCase();
switch(command) {
case "ping":
message.channel.send('Pong!');
break;
default:
break;
}
});
client.login(token)```
can you
stop
just do taht
spamming the code blocks
that
its not
what now
@earnest phoenix just in the future dont do it like that k
anyways is this the right format for playlist
const playlistPattern = /^.*(youtu.be\/list=)([^#\&\?]*).*/gi;
@earnest phoenix use this https://discord.js.org/#/docs/main/stable/general/welcome
it will help u alot
did someone say breaded fish?

cry bro chill this is what this channel is for
well but it's not for spamming
no not spamming
It turned it was going into the console
and not the server itself
How do I do that?
do what?
get the bot to say its command in the server
ok I deleted the console part
because it was going straight to the console instead of the server
const Discord = require('discord.js');
const client = new Discord.Client();
const { prefix, token } = require("./config.json");
client.on('ready', async () => {
console.log("Ready!");
});
client.on('message', message => {
if (message.content === 'replaced') {
message.channel.send('why did you say the r word?');
}
if (!message.content.startsWith(prefix))
return;
const args = message.content.substring(prefix.length)
.trim()
.split(/\s+/);
const command = args.shift().toLowerCase();
switch(command) {
case "ping":
message.channel.send('Pong!');
break;
default:
break;
there's nothing wrong
You used a space between the prefix and command
i keep getting a events.js error help?
pb!ping not pb! ping
I did but its not working
does the console say any error?
You should add Console.Write() in your code to check what is being given then and you might find out
i keep getting a events.js error help?
@elder garnet you need to give us info about the issue
Show us the error message
then look up the line
you having a brain error too
i am reinstalling npms too lol
im ona school tablet i cant copy and paste stuff lol
Wait why are you coding on a tablet
im not coding on a tablet
lol
im coding on my pc
i use my tablet to use discord
ar u an caveman
lolno
Wait what was that github you just deleted 
that has nothing to do with discord whatsoever lmao
Have you tried some of the solutions in there then?

l o l
Well I am new to making discord bots and I am trying to make a basic game of war for my bot using discord.py and I am having error and I don't know how to fix it as it happens when I try to either take a card away from one player and give to another. I am using two separate list (one for the player's cards and one for the computer's card) and I'll copy and paste the code in here. The error is that the integer is not subscriptable.
unhandled error event meants the event emitter emited an error, which was not handled by your program
the event emitter in this case is your discord client
in order to catch an error event, simply add an event for it
client.on("error", console.log)```
okay
this will log the error instead of throwing an error and crashing your program
Well I am new to making discord bots and I am trying to make a basic game of war for my bot using discord.py and I am having error and I don't know how to fix it as it happens when I try to either take a card away from one player and give to another. I am using two separate list (one for the player's cards and one for the computer's card) and I'll copy and paste the code in here. The error is that the integer is not subscriptable.
async def playwar(ctx):
cards = [2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15]
random.shuffle(cards)
playerhand = random.choices(cards, k=27)
cpuhand = random.choices(cards, k=27)
playercardnumber = 27
cpucardnumber = 27
nowinner = True
while nowinner:
await ctx.send('Let the game begin')
time.sleep(2)
if playerhand[0] > cpuhand[0]:
await ctx.send(playerhand[0])
await ctx.send(cpuhand[0])
await ctx.send('player has won this round')
playerhand.append(cpuhand[0[:-1]])
cpuhand.remove([0])
playercardnumber += 1
cpuhand -= 1
print(playerhand)
time.sleep(2) ```
im not familiar with python, but does random.choices return one item from cards? if so, then playerhand[0] is trying to get item 0 from what is already a final item
The error is the line with playerhand.append(cpuhand[0[:-1]])
and what does the error say
if playerhand is an item from cards, then it is a number
TypeError: 'int' object is not subscriptable
you cannot append something to a number
ah yes
I know that error
cpuhand is a number
you can't index from a number lmao
is like doing
3[0]
Tim is this playlist format right i know it wrong but i dont know the format
const pattern = /^.*(youtu.be\/|list=)([^#\&\?]*).*/gi;
idk
XD
np
use some regex tester online and test it against some real links
https://regexr.com/ test it
ohhh didn't know this existed thx
there are dozens of those lul
How long does it take usually for a MongoDB database to update?
So is there anyway that I could fix that error without changing the cards list from integers to strings? If I change the integers in that list to strings then I obviously cannot compare a string to a string
got a js question, i'm using window.location.href = '...'; on a button using onclick, how do i set the target to open in a blank tab
you don't
is there any reason I can't do this
bot.on('message', msg => {
console.log(`${msg.author.username}: "${msg.content}" ${msg.guild.name} ${msg.guild.id}`);
}); ```
i mean couldn't you just append target attribute to the button
or wait is that for links only
well i'm asking here
you're changing the current window's location
you need to create a new one
use window.open
Interesting
btw is it easy to make it where your bot can have multiple languages
pretty much
if you code it right

so i need the lang file ex eng an command to run the thing and an save file like json or sqlite
For example good handler that takes care of the preferences & messages for you
i shall try
Hmm
first you need to store the guild language in a database, then store your responses in some .json file with the locale name, e.g en_US.json would be
{"greet": "Hello!"}
while fr_FR.json (french) would be
{"greet": "Bonjour!"}
then on boot load those json files into some service in memory, then replace everywhere you send a message with those responses, e.g "Hello!" would be replaced with responseService.get(guild locale, "greet") etc
just to note that you won't have much use out of a multilangual bot since chances are whoever uses/will use your bot already understands how to use it in english
i saw something like this somewhere responseService.get(command : grate)
and in the json file like {command
{ grate : 'great',
}
}
Tim, idid your client.on("error") thing but i still get the error
error:EADDREINUSE address already in use
the events.js is is not defined in my code
so its a nodejs problem i guess?
EADDREINUSE means you're trying to use a port that is already being used
you cannot use the same port multiple times
How do I kill a process on a port so I can use it for other things?
depends on the operating system
Im using CentOS Linux
but 99% of the times its your own process thats trying to use the same port more than once
btw await in JS makes it so that the code must wait for a promise before proceeding right?
yes but only inside the async block, code outside that block will continue to run normally
when using a regex, how would it match "owo" at a random position?
for example "test34Owoq92"
aight, ty
Is there anyway to send the logs from my bot to a specific channel in my discord server?
Yes, i think you would have to first find your guild
var myGuild = client.guilds.cache.find(g => g.id == YOUR_GUILD_ID)```
then find the channel in your guild
```js
var logChannel = myGuild.channels.cache.find(c = c.id == YOUR_CHANNEL_ID)```
you can send messages and stuff to this channel now
```js
logChannel.send("whatever you want")```
Have any of you Devs used Glitch.com to develop your bot, and willing to help me with some things?
@clear wraith what kind of things
ok i am going to use this chat alot bc i want to upgrade for 11 to 12 but i lazy hence i will ask u botaful people
Plus I'm kinda new to the whole thing
you should try using this because i think it shows all of the changes
https://discordjs.guide/additional-info/changes-in-v12.html
but maybe bot.guilds.cache.forEach()
guilds.cache
kk
Do anyone have experience with a bot call Alice I’m having trouble with it
their support server can probably help you more than here
That what been doing some reason I can’t find it but look harder thx anyway
@tawdry tangle https://nmw03.is-inside.me/459NDMOz.png
@summer torrent Um different bot name alice https://alice-bot.net/
@clear wraith what errors?
On when I type my command c!help It sends Glitch.com errors
And my help menu doesn't show up

what error pops up?
Ill take a pic
sure
The first line says... (node:173) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'tag' of undefined
Then it has Jump To Sections.
No
thats glitch
why does os matter?
Cause snipping tool on windows
ah lul
Make it easier
could also copy and paste the actual text
True
The First one jumps to... My help.js file... The error line (line 10) says..... .setDescription(If you are having any trouble, please join our server and contact the bot creators ${owner.tag} and ${owner2.tag}.)
No
guid owners aren't cached
Sorry, I'm new at this
*guild
cannot read X of undefined means you're trying to access a property of something that doesnt exist. for example if owner2 does not exist, then owner2.tag will throw that error, because "it cannot read tag from something that doesnt exist"
No
OMG
help i dont know what is wrong
to fix this error, you need to look at how you define owner and owner2, ie: look at where you create them. you have to make sure that they properly exist and are valid
@earnest phoenix error?
Cannot read property 'catch' of undefined
its bc 11 to 12
i cant see any thing in the discord js doc
@clear wraith maybe owner.user.tag?
no, the problem is that the user is not cached
That catch error is annoying
wow u didnt put the , after ever field
@earnest phoenix show error
@clear wraith https://www.take-a-screenshot.org/
whats the code?
look above
@clear wraith instead of client.users.get("ID"), do await client.fetchUser("ID")
@earnest phoenix show message.js line 34
@clear wraith
sigh
learn how to take ss please
it is pretty annoying
Dude... Im taking pics from my phone
NOT screenshots
just do windows + PrtSc
taking screen pics from phone is bad idea
or use the snipping tool
@earnest phoenix .catch() only exists in async functions. your function is not async
@earnest phoenix do try and catch instead
hmmm is it discord 12 change bc it used to work in 11
Am I allowed to invite people to my glitch.com project?
i literally told you exactly what you need to do. what didnt you understand??
Can i invite one of you?
@earnest phoenix discord does not change async functions and .catch in anyway. this is normal javascript no packages will change that
@clear wraith instead of
client.users.get("ID"), doawait client.fetchUser("ID")
@quartz kindle
NOTHING @quartz kindle, I UNDERSTOOD NOTHING
lol
😐
kk apple
u can do try and catch instead
change it from
let owner = client.users.get('ID')```
to
```js
let owner = await client.fetchUser("ID")```
whut happend here?
do the same for owner2
lol
Ok
Tim is mad?
Tim?
fear me
how is that possible
lol
Once Tim gets mad, the world is doomed
Bye
Luv u tim no homo 
if (message.author.id === config.owner) is this right
or message.author.id has been changed to something
no its fine
should be that
discord 12 reallt stumped me as well
discord 12 will give me high blood pressure
jda had a really good transfer guide
I know, I probably Make you guys mad...
Listen, I am a beginner at this stuff.
So just bare with me if I don't understand something. I will Eventually understand what you are talking about.
i mean how do i get a channel
message.channel.cache.get
bruh this is why you dont cop code on the interwebz and use youtube tutorials for everything lol
it used to be msg.guild.channels.get("id") but now its idk
message.channel.cache.get
thx
@dusky garden if you are making a private bot for a server then you dont need guild
also how do i find a channel via name?
what if i changed this if (message.author.id === config.owner) to bot.users.cache.get('266636923387248640');
hmmmm
try it
lets see
idk if it's better but there is also bot.users.fetch('266636923387248640');
yeah, it probably doesnt
it worked
which one
hmmm so it was this (message.author.id === config.owner)
oof
noo
i mean the other one
this doesn't work anymore (message.author.id === config.owner)
idk why
maybe it changed a bit
cmdFile(bot, msg, args, ).catch(err => {}``` what to do with this
make it async
??
its not an big deal it still works but the error will fill my console with crap
does anyone know how to use node.js to use multiple cores instead of just one core?
tony help
i have an arr like this:
[
{ id: 0 },
{ id: 1 },
...
]
how would i find if the array has the object i need (ie. 1)
also whats up
just do
if(cmdFile) {
try{
cmdFile(bot, msg, args, )
} catch(err){
//err code
}
@sick cloud text is right above you
Cannot read property 'catch' of undefined
I would try to use a loop and go through each one to see if it has an id that equals to 1
kk apple thx
k
show full error
h0w t0 make a 8ball cmd?
msg.mentions.users.first() what is this replaced with 11 to 12
too lazy to chek the doc
is it data
mentions.has() has been added, replacing message.isMentioned() and message.isMemberMentioned(). It has two paramets: the first is data representing a User, GuildMember, Role, or GuildChannel and an optional options object.```
msg.mentions.users.first() this still works
hmm show me code
error?
Supplied options is not an object. i think
code
U didnt add the message.channel.send?
ooh
its below
Oh
what is it showing when u run cmd
whats not working
do u get an err or what
(node:16208) UnhandledPromiseRejectionWarning: TypeError [INVALID_TYPE]: Supplied options is not an object.
full error?
screenshot it
what part of the code does it take u to
wait let me do an support test
which file what line?
ok nvm
?
how do i find the bot count of a server?
wdym?
this is the error
filter()
guilds memebrcount?
oh
message.channel.guild.memberCount.filter((e) => e.bot).length
:p
@earnest phoenix show your code
look above
thats not code
@digital ibex this is wrong
memberCount is a number 
how do you can filter "memberCount"
lemme show u rq
OH
my bad
@dusky garden use ```js
message.channel.guild.members.filter((e) => e.bot).length
*size
oh
length is for Array
godness
without .length it returns an array then
does it?
which lib are you talking about
eris
discord.js
yah
its pretty similar for d.js
cba to log it
message.guild.members.filter((e) => e.bot).size
thats for d.js
yes
got an err
k i fixed for some reason the error was the report thing it works now 
D:\Bot Counter\index.js:16
let botCount = msg.channel.guild.members.filter((e) => e.bot).length
^
TypeError: msg.channel.guild.members.filter is not a function
at Client.<anonymous> (D:\Bot Counter\index.js:16:46)
at Client.emit (events.js:210:5)
at MessageCreateAction.handle (D:\Bot Counter\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (D:\Bot Counter\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (D:\Bot Counter\node_modules\discord.js\src\client\websocket\WebSocketManager.js:386:31)
at WebSocketShard.onPacket (D:\Bot Counter\node_modules\discord.js\src\client\websocket\WebSocketShard.js:435:22)
at WebSocketShard.onMessage (D:\Bot Counter\node_modules\discord.js\src\client\websocket\WebSocketShard.js:293:10)
at WebSocket.onMessage (D:\Bot Counter\node_modules\ws\lib\event-target.js:120:16)
at WebSocket.emit (events.js:210:5)
at Receiver.receiverOnMessage (D:\Bot Counter\node_modules\ws\lib\websocket.js:801:20)
error?
what is your djs version
newest
v12
yes
would the
message.guild.members.filter((e) => e.bot).size```
work in a botinfo logging the amount of bots in a server
that is members.cache.filter
i downloaded yesterday
dumb useless cache
make respponses an array
u got 0 den :p
0 cached*
@elder garnet make the responses an array and do the math stuff math florr
and send it
make respponses an array
then send responses randomly
he gets what i mean
or?
ok
tried
idk
something like
i dont get it
goose 8ball hello im goose
how do i filter the bots?
a text
let responses = [
'option 1',
'and',
'so',
'on'
]
in v12
@dusky garden filter(m => m.user.bot)
ik the responses thing
i still dont get it
what dont u get den?
just the cmd
let botCount = msg.channel.guild.members.filter((e) => e.bot).length
user.bot
what does that become in v12
@dusky garden its not msg.channel.guild.memebrs...
message.guild.members.filter((e) => e.user.bot).size```
then it returns
oh

cache.filter
djs too
K
where the hell did you get 7270 bots?
channel is a a guild property for eris
@digital ibex https://discord.js.org/#/docs/main/stable/class/TextChannel?scrollTo=guild
@dusky garden ```js
message.guild.members.cache.filter((e) => e.user.bot).size
ok

cache.filter in v12
works thx!
.user.bot
the error is in the console doe
pm2 logs --lines=100
bot.users.size```
(v11) anyway to get it so it can find every user in every guild
discord 12 is cringe
how do i get the full error then?
pm2 logs --lines=100
@summer torrent
just !user.bot
i have crap tone of code to convert to 12

{"listOfSaves":[["3/30/2020",{"...":"..."}]]}
How do you get the date in listOfSaves? What would be the location?
if (!msg.member.hasPermission('BAN_MEMBERS') discord 12 if(permissions.missing(['BAN_MEMBERS']))
? am i suposed to do it like that
ok then has perm
hasPermission renamed to permissions.has()
ok so it will beif (!msg.member.permissions.has('BAN_MEMBERS')
soo many changes
lol
but i like this one
K
How can I check if an array element exists?
example
if (array.indexOf(element) === -1) {} // doesn't exists```
I have this:
await sql.prepare(`DELETE FROM quests WHERE id = ${message.author.id}`)
but it never deletes that users data
nvm
also
is it supposed to make 3 sql files
is it possible to make it one
does the amount of files affect performance as it has to reach different locations?
Does anyone know on python how to move the first element in a list and make it the last element of that same list? I've been searching on how to find it but haven't found what I am exactly looking for
@past trail a, b = list[0], list[1]
then after that
list[b], list[a] = list[a], list[b]
i got a question
if (!fs.existsSync(`./users/${playerId}.json`)) {
fs.createReadStream('./users/template.json').pipe(fs.createWriteStream(`./users/${playerId}.json`));
how can I make it wait for the copy to complete before running the rest of the function
can someone please explain this
I really dont understand
does that increase speeds?
Ok, I can take actual screenshots now if someone can help me with my bots errors..??
Well, If i could figure out how to get my bot back online, I could show you
ok then
Are you Familiar with https://glitch.com/ ?
no
Oh ok
but i recommend you shell out the $3 for a host
Seems to still exist as of the latest jquery docs however they do say Deprecation Notice The jqXHR.success(), jqXHR.error(), and jqXHR.complete() callback methods are removed as of jQuery 3.0. You can use jqXHR.done(), jqXHR.fail(), and jqXHR.always() instead.
got it
also const submitButton = document.getElementById('submitButton'); submitButton.append('disabled', 'true');
by any chance is that possible
(to disable a button)
no idea lol
I've never used JQuery, what is it used for?
and what is that $ function used for
and why do people always define $this
makes no sense to me
prop disabled true got it
Oh, command not here.
@copper cradle $ is simply a variable. I believe it refers to the document root (someone correct me if I'm wrong)? If you're familiar with lodash, you may have seen _ used to access methods from the lodash package in regards to NPM and Node
jQuery in a nutshell is simply a library that makes coding in Js a lot better and even more robust
if (!fs.existsSync(`./users/${playerId}.json`)) {
fs.createReadStream('./users/template.json').pipe(fs.createWriteStream(`./users/${playerId}.json`));
how can I make it wait for the copy to complete before running the rest of the function
ah, thanks for the explanation @stark terrace
No problem
My bot is back up and running! Thanks to the ones who helped me!
On discord.py is there any way to have a command terminate or stop another command while the command I want to terminate is still running? or do I use an event?
You could seperate the commands into threads and then terminate the threads
@sick cloud if you didn't figure out, $.post is still available in latest jQuery. Just a shorthand version for post. There's also $.get
yep
Error: Cannot find module 'C:\Users\namehere\Desktop\name 2020-2021'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
at Function.Module._load (internal/modules/cjs/loader.js:864:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
it cant find the module for node, anyone know why?
You're not even loading a module you are using a file path 
oh
what am i supposed to do then
😆
how can I remove all of a users role and then when they react to the message it sends add them back?
@prime cliff whats the soloution
What are you trying to import?
wdym
What are you trying to do with your code
That's not how it works you need to actually code a bot
@earnest phoenix check your lib docs for guildmember and use the functions to get all roles, store that data with the user id and then foreach remove all roles
why is tupperbox offline ;-; wait is this even the right server- o-O”.
Nope
f-
Use the join support button on the site
okAy tHanks
Builderb this is what I came up with targUser.roles.remove(targUser.roles)
What are you trying to use with that?
Also the code for that is wrong
Console.log is a function not a variable and i'm pretty sure the syntax for that is wrong
To be fair, I kinda cheat when making bots.
ah, that was from my old line of code oop
Cheat how? because stealing other peoples code and/or cloned bots is bad you should actually learn something new
I use a website called BotGhost.
Ah
is that a bot builder
It allows you to add cpmmands, without actually coding.
commands*
Technically not cheating but DBL does not allow those bots because it's basically a template and very limited
True.
I dont think it's cheating, it's just another way of doing it. It's up to the person if they want to learn or not
I mean, I used to be great at coding. Then I learnt other stuff and forgot how to do it.
anyway Builderb what I'm trying to accomplish is that when the command is executed it will remove the users current roles and add another role.
What lib are you using?
djs
Is it possible to learn coding just by looking in a coding-based chat?
you might learn how to make errors
Well you can but its really hard
lol
@earnest phoenix you can use the GuildMember.roles to get a list of roles or add/remove them
https://discord.js.org/#/docs/main/stable/class/GuildMember?scrollTo=roles
https://discord.js.org/#/docs/main/stable/class/GuildMemberRoleManager
Yeah, and it wouldn't help to have ASD.
That is gonna stop me from learning this big-time.
Lol.
Afk I'm gonna go watch some YouTube coding courses.
If you want to learn how to code i can suggest you this javascript guide https://anidiots.guide/getting-started
Maybe then I can have a good bot 😄
Oh, thanks!
@prime cliff it comes with the same error message
What are you trying to run?
But what lib and code
Error: Cannot find module 'C:\Users\name\Desktop\name2020-2021'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
at Function.Module._load (internal/modules/cjs/loader.js:864:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
That's the error what is the code you are trying to run?
const Discord = require('discord.js');
const client = new Discord.Client()
const token = '';
bot.on('ready', () =>{
console.log('This bot is online')
})
bot.login(token)```
How do you actually get into the bot code?
You should read this guide too powfu https://anidiots.guide/getting-started because you probably don't have the Discord lib installed with package manager i guess
powfu try npm install discord.js
Wait, is that how you edit code?
That installs the Discord lib
PortalFan you are using windows right?
Yes.
do you mean edit code as literally, how do you type it into a file or?
Windows 10
Go to that guide i linked above and click windows
Literally.
Oh,
I was reading Getting Started, lol.
Is it node.js we install?
Yup
Great, thanks.
I'll download it now.
@prime cliff sorry for the @ but do you have any good js tutorials you suggest?
10-15 messages up
I had a look at that, looks more focused on just creating your first djs bot?
Which page?
Click that and read.
Not the nprmal Getting Started,
if you were.
Now, I play the waiting game as it installs to my computer,
how to get app id?
App ID?
application id
Click the copy button next to the client id text on the dev portal
Huh?
Can someone tell me what i missed?
if (command === "balance") {
const balembed = new Discord.MessageEmbed()
.setAuthor(`${message.author.tag}`, `${message.author.avatarURL()}`)
.setColor([173, 216, 230])
.addField("**Balance**", "**" + `${output.balance}` + "**")
.setFooter(
`${footer}`,
`${avatarURL}`
);
if (message.author.id !== config.ownerID) {
var output = await eco.FetchBalance(message.author.id);
message.channel.send(balembed);
} else if (message.author.id === config.ownerID) {
var user = message.members.mentions.first();
if (!user) {
var output = await eco.FetchBalance(message.author.id);
message.channel.send(balembed);
} else {
var output = await eco.FetchBalance(user.id);
const baleembed = new Discord.MessageEmbed()
.setAuthor(`${user.tag}`, `${user.avatarURL()}`)
.setColor([173, 216, 230])
.addField("**Balance**", "**" + `${output.balance}` + "**")
.setFooter(
`${footer}`,
`${avatarURL}`
);
message.channel.send(baleembed);
}
}
}
```?
Tbh I know nothing, lol.
XD
error?
@high bough read the message.channel.send
Although I am doing a course online.
Click the copy button next to the client id text on the dev portal
@cursive dagger Isn't that basically your bot's id?
@high bough read the message.channel.send
@prime cliff What do you mean?
On older apps there is a difference
oK i AM SUPER CONFUSED. wHAT IS THIS? oOF MY KEYBOARD HAS INVERTED MY CAPS.
It's called coding a bot
The code is a bit weird though why is he trying to use 2 embeds when he could just use 1
Ik it's coding, I am just confused by var and beleembed and balembed and balance.
the top code is for non owner user which allows using )balance only, while the bottom one allows owner to use )balance @granite pagoda but also returns the user being me if it's blank.
The code is a bit weird though why is he trying to use 2 embeds when he could just use 1
@prime cliff
Ik it's coding, I am just confused by var and beleembed and balembed and balance.
@earnest phoenix Baleembed and balembed is just a random name for defining my embed, it can be anything.
Balance is the command>
And var is ... var?
What does var mean exactly? I've never heard of it.
it means variable in javascript
Oh!
how do i get application id i have client id and client secret
So it is shorter for another word?
@earnest phoenix #502193464054644737
I get it now.
if i say ```js
var hi = "hi!"
> What does var mean exactly? I've never heard of it.
@earnest phoenix
how do i get application id i have client id and client secret
@earnest phoenix Application ID is the Client ID
ok
Yea but like it could just be
var output;
var user;
if (message.author.id !== config.ownerID)
{
user = message.author;
output = await eco.FetchBalance(message.author.id);
}
else
{
user = message.members.mentions.first();
// Check if user is not null or has mentions too
output = await eco.FetchBalance(user.id);
}
and then do the embed
const baleembed = new Discord.MessageEmbed()
.setAuthor(`${user.tag}`, `${user.avatarURL()}`)
.setColor([173, 216, 230])
.addField("**Balance**", "**" + `${output.balance}` + "**")
.setFooter(
`${footer}`,
`${user.avatarURL}`
);
message.channel.send(baleembed);```
Yeah, okay I'm not that smart i coding
Is the ID not the Secret Token?


