#development
1 messages · Page 980 of 1
what
plz ping and reply
pls help
it literally says No DBL token has been provided.
Add a bot token
Because of you have a bot and on the code says: No DBL token has been provided , you just add a bot token there.
hlo
const blackjack = new Discord.MessageEmbed()
blackjack.setColor("#ff00ff")
.setAuthor(`${message.author.username} VS ${bot.user.username}`)
.addFields(
{name: `${message.author.username}'s Deck:`, description: `${aaa[a]} of ${cards[card1]} & ${ccc[c]} of ${cards[card3]}\nValue: **`${ac}`**`},
{name: `${bot.user.username}'s Deck:`, description: `${bbb[b]} of ${cards[card2]} & ||${ddd[d|} of ${cards[card4]}||\n Value: **`?`**`, inline: true},
)
message.channel.send(blackjack)
this is my embed
I've already added dbltoken in config.js
which has very bad formatting
lol
/home/runner/Trade-Bot/commands/bj.js:132
{name: `${message.author.username}'s Deck:`, description: `${a
aa[a]} of ${cards[card1]} & ${ccc[c]} of ${cards[card3]}\nValue: **`a`**
`},
^
SyntaxError: Unexpected identifier
why am i getting this error
does it know its in config.js
no
welp theres ur problem
how should i do?
Escape with \
how should i do?
@rigid maple
on line 6 it looks like u are ending the string then starting a new one inside the description of the field, try removing the 2 ` 's on either side of ${ac}
also i got a question: in v11 i could remove a reaction by a specifc user by doing reaction.remove(user) where user was their user object, although this doesnt work in v12 now so anyone know i would do that?
i fixed it lol
but
let A = parseInt[aaa[a]]
let B = parseInt[bbb[b]]
let C = parseInt[ccc[c]]
let D = parseInt[ddd[d]]
let ac = A + C
let bd = B + D
const blackjack = new Discord.MessageEmbed()
blackjack.setColor("#ff00ff")
.setAuthor(`${message.author.username} VS ${message.client.user.username}`)
.addFields(
{name: `${message.author.username}'s Deck:`, value: aaa[a] + " of " + cards[card1] + " & " + ccc[c] + " of " + cards[card3] + "\nValue: **`" + ac+ "`**"},
{name: `${message.client.user.username}'s Deck:`, value: bbb[b] + " of " + cards[card2] + " & ||" + ddd[d] + " of " + cards[card4] + "||\n Value: **`?`**", inline: true},
)
message.channel.send(blackjack)
why is a far off to the left randomly
lol
ac and bd show: NaN
which means i messed up the math
how do i fix it
plz help
that probably means that the parseInts cant parsae whatever those variables are so they just return NaN, also i prefer to use Number() than parseInt, for example Number('10') returns a number which is 10
what are those anyway, aaa[a], bbb[b] etc
it'd still return nan with number
OH wait u need parseInt() not parseInt[]
Define "actual time"
actual time as in unix?
You can use .strftime to format the time
what
yeah, what about it?
umm
hi im back
brb
see
aaa is the array
and a is the math random function
so its aaa[a]
@twin pendant
so what do i do
oh
ohhh
lol ok
if its an actual number then u shouldnt need to parseInt
what
it is an actual numbr
and () didnt work
if i just do A = aaa[a] + ccc[c]
it gives
like if aaa[a] is 2 and ccc[c] is 4
it gives 24
even thought its not a string
oh
let aa = [
['Ace', 1 || 11],
['2', 2],
['3', 3],
['4', 4],
['5', 5],
['6', 6],
['7', 7],
['8', 8],
['9', 9],
['10', 10],
['Jack', 10],
['Queen', 10],
['King', 10]
];
let aaa = aa.map(item => item[0])
let a = Math.floor(Math.random() * aa.length);
this is how it looks
so do you know why it isnt working
oh ok so aaa[a] is going to be a string since you are picking something randomly out of an array
Is it okay to have a database query each 2 seconds with 56 guilds? I don't think so
that's average of 50h
what do you want to do? Getting a random element?
const randomElement = aa[Math.floor(Math.random() * aa.length)];```
no
ow
idek haha ill leave it to you menno
that's just js aa.push(newElement);
get random elements and add them and add them?
xd
wym
see i already haverandom elements
thats how strings work
let aa = [
['Ace', 1 || 11],
['2', 2],
['3', 3],
['4', 4],
['5', 5],
['6', 6],
['7', 7],
['8', 8],
['9', 9],
['10', 10],
['Jack', 10],
['Queen', 10],
['King', 10]
];
let aaa = aa.map(item => item[0])
let a = Math.floor(Math.random() * aa.length);
see
now
make it into a number, first check if it even is a number first
it isnt cuz its in an array
what
wat
why are you making the numbers be a string?
theres no point doing that
i dont have them in quotes
remove the quites?
Number('randomNumber') gives you the number object of it
yes u do
but it still works like a string
no it won't
if you do Number('6') it will give you the number 6, so you can do 6 + 1 = 7
what are you talking about, because it does, so maybe i don't properly understand ur issue
it doesnt let me show you
uh
what doesn't
yes. because string1 + string2 = string1+string2
oof
try{
const varname = setInterval (function () {
message.channel.send("message")
}, 3000);
}catch (err){
console.log(err)
return message.channel.send("Something went wrong")
}
if(var === 1){
clearInterval(varname)
message.channel.sendmessage.channel.send(`message`)
}
Error varname is not defined
Do they have to be in the same part of the code
varname is in try and you're trying to access it outside of it
Ahhh thanks
request it be removed from the server
no
your problem then
i want it to stay here
its got to do something with your code
^
maybe the way ur handling users, and if u've got a db, the way ur handling users in ur db
@rigid maple have u got a database
Can someone teach me how to make my music bot use soundcloud links and spotify playlist links?
I have quick.db but I don't know how to use it
@rigid maple what
quick.db mevcut ama kullanmayı bilmiyorum (use translate turkish to english)
@rigid maple no turkish allowd here
^
Error: Could not locate the bindings file. Tried:``` error
show full error
try running enable-pnpm in your glitch console
glitch is having issues with packages btw
try running
enable-pnpmin your glitch console
@quartz kindle ok
try running
enable-pnpmin your glitch console
@quartz kindle console = terminal?
yes
ohk
it does nothing
no it gave new error wt!
it says throw err; ^ Error: Cannot find module 'dotenv' BUT I HAD ADDED IT AHH
show your package.json
"//1": "describes your app and its dependencies",
"//2": "https://docs.npmjs.com/files/package.json",
"//3": "updating this file will download and update your packages",
"name": "hello-express",
"version": "0.0.1",
"description": "A simple Node app built on Express, instantly up and running.",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"dependencies": {
"@discordjs/opus": "^0.3.2",
"ascii-table": "^0.0.9",
"common-tags": "^1.8.0",
"discord.js": "^12.2.0",
"request": "^2.88.2",
"request-promise": "^4.2.5",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"discord-anti-spam": "^2.4.1",
"fs": "^0.0.2",
"moment": "^2.26.0",
"mongoose": "^5.9.16",
"quick.db": "^7.1.1",
"simple-youtube-api": "^5.2.1",
"weather-js": "^2.0.0",
"weather.js": "^0.1.0",
"ytdl-core": "^3.0.0",
"ytdl-core-discord": "^1.2.0",
"node-fetch": "^2.6.0"
},
"engines": {
"node": "12.x"
},
"repository": {
"url": "https://glitch.com/edit/#!/hello-express"
},
"license": "MIT",
"keywords": [
"node",
"glitch",
"express"
]
}```
👀
remove fs and weather.js 0.1.0
also are you using quick.db or mongoose?
remove the one youre not using
also are you using quick.db or mongoose?
@quartz kindle quick
remove
fsandweather.js 0.1.0
@quartz kindle m using them!
fs comes with javascript you dont need it
fs is built in, not a module
ok
let me add new one ? @quartz kindle
also request and node-fetch do the same thing
ohk
which one are you using?
which one are you using?
@quartz kindle request
request is deprecated btw
const request = require('request');So what should i do?
you can switch to just node-fetch since it is still maintained
🧐 how 🙄
https://www.npmjs.com/package/node-fetch read the examples, it is pretty straight-forward
ok
i never used request so can't give a simple answer on what exactly you'd need to change.
ohk
axios is great
Anyone know how to make a queue system? I am working on a 1v1 bot and I decided to make a feature where once a player reacts to a message, it puts them in a queue to find another player that recently reacted to that message that hasn't already found a 1v1. Once they get matched, the bot will create a channel in selected server exclusive to the player and the player's opponent. I can do all of this except for the queue part, anyone have any ideas?
I was thinking of using a json file but idk
just use Map or Array
Does it need to be stored through reboots?
Then an array does it fine.
When a spot is open, grab and remove the first thing from the array
When someone joins, put them at the end of the array
array in what?
What do you mean?
An array array
However an array array is something else.
Its just an array
Pretty sure every programming language calls an array
oh
An array
ok
oh shit
i was confused
yeah I guess I could use an array
however im not so familar with that, how do I replace stuff from the array
Depends on the language.
python
In this tutorial, you’ll learn about Python arrays, the difference between arrays and lists, and how and when to use them with the help of examples.
Covers modifying arrays, including slicing the first one out, and adding(extending) new ones in
why would you use arrays in Py when you can use a list or deque for that job
Arrays have zero benifit for that purpose lol
no
Because Arrays only support 1 data type
well c# has like 6 different array types
Lists support any combination of data types
I wonder why it's needed
Since you only are storing the id of the user I would presume
Legit a list of be easier
And the user data in the cache
Please help me https://hastebin.com/duzasimoca.sql
i use discord.js
Windows 2012 kullanmasını bilen varmı
(Does anyone know how to use Windows 2012)
wdym
heroku only works in administrator cmd but git doesnt but without administrator git works but heroku doesnt ???????? someone help me
lol 😭
what???
d.py: How do I make a text channel and set the permissions to specific members can read and text?
thx
How accurate is client.users.cache.size for displaying total members the bot is serving in each guild?
100% if you cache all members, else depends on size of guilds your bot is in
But I wonder if it actually caches all members or not
Now it is a reasonable 29 but if it gets approved it will be much bigger because of the user size of this server
There is an option for that but it's disabled by default
You have to manually enable it
But users takes ram
Hi, I have an XP System which works kinda' okay until people start to spam. I thought it was something else but when I disabled my Xp Cog everything worked fine. I tried to debug my code and it seems that the problem lies somewhere in when the bot gives Xp. Also the Bot is made in Python3.
async def _add_xp(self, user: discord.User, amount):
await self._submit_xp(user, amount)
userData = Rank.getUserRank(user)
if userData["level"] >= 10:
newRole = Rank.getClassFromRank(userData["rank"])
else:
newRole = "Citizen"
if not newRole in [y.name for y in user.roles]:
member = DisplayName.memberFromId(user.id)
await Rank.stripMemberClasses(member)
new_role = discord.utils.get(member.guild.roles, name=newRole)
await member.add_roles(new_role)```
How does one enable it
The bot slows down completely when people start to spam, if anyone might know what's wrong let me know!
make cooldown
or simply dont store in db everytime
just cache, and make interval wjen it saves to db
I'd suggest using IDs and get_role instead of using names
But I'm waiting long time, after this error shards is not starting
When I try some codes about shard, it says shard are still spawniing
I have a cooldown
so?
@jaunty frigate English only in here(Burada sadece ingilizce konuşabilirsin diye biliyorum.)
hello
does anyone know
how to
collected certain messages after certain other words are collected
like
i made a blackjack command
so if you
hit
you get more cards
but i made another filter for the next hit if someone wanted one more
but now what happens is
if i type hit both the hits take place at the same time
what do i do
you have two collectors both collecting "hit"
yea
@earnest phoenix can you help me for sharding? in dms?
i want to speak my main lang
@solemn latch so like what do i do
@heavy pollen No,i can't sorry bc i'm not using "shard".
see
how do i
allow the message to be collected only after the first one
so someone doesnt do hit2 at the starting itself
Why do you need two hit collectors again?
You can just use one, delete it when it collects a hit, and create the same collector again if the game is still going
delete collector
can anyone help me?
client.on('message', message => {
if (message.content === `${prefix}help`) {
message.channel.send
const exampleEmbed = new Discord.MessageEmbed()
.setTitle('Help')
.setDescription(`
The commands are as listed:
.kick = kick command
.ban = ban command
.server = shows basic stats of the server you are in.
.user = shows name and id of user.
.invite = invite the bot to your server!
.join = join the official server!`)};
message.edit(exampleEmbed);
what is wrong?^
@solemn latch idk i haven't tried it
Then try it 
i got the error as un expected end of input
Can you post the entire stack?
ok
why u using const after message.channel.send ?
yeah wait
Hi uh anyone know how to move from mongodb localhost to mongodb cluster
const embed = new Discord.MessageEmbed()
.setColor('#26ff00')
.setTitle(`Join Guild!`)
.addField(`Guild Name`, guild.name, false)
.addField(`Guild ID`, guild.id, false)
.addField(`Member Count`, guild.memberCount - 1, true)
.addField("Humans", `${guild.members.cache.filter(member => !member.user.bot).size} `, true)
.addField("Bots", `${guild.members.cache.filter(member => member.user.bot).size}` - 1, true)
.addField(`Owner`, `${guild.owner.user.tag}[${guild.owner.id}]`, false)
return embed```
@long yew
This works
message.channel.send(embed)
where do i put that?
do it like this one sec
ok
Hello guys, I updated my bot to v12 but my bot not works in v12 with sharding. But works in v11 with sharding. I'm getting this error when wait some minutes:
Discord.js v12.2.0
Node.js v12.18.1
My bot have 4.000 servers.Error: https://hasteb.in/adeteyux.sql
Shard.JS: https://hasteb.in/yovukupo.js
@heavy pollen any help please?
Full error?
show server.js
const embed = new Discord.MessageEmbed()
.setColor('#26ff00')
.setTitle(`Join Guild!`)
.addField(`Guild Name`, guild.name, false)
.addField(`Guild ID`, guild.id, false)
.addField(`Member Count`, guild.memberCount - 1, true)
.addField("Humans", `${guild.members.cache.filter(member => !member.user.bot).size} `, true)
.addField("Bots", `${guild.members.cache.filter(member => member.user.bot).size}` - 1, true)
.addField(`Owner`, `${guild.owner.user.tag}[${guild.owner.id}]`, false)
return embed```
how do i make this into a help command or other command?
I think TXJ is writing something up for ya
ok
txj seems pro at this
you're really dumb
ok thanks i'll try it
@vale garden collectors have a max option
In the options, its max: 1 I think @vale garden
ok thx
if you want to make it easier on yourself move the embed variable to a file
if you need reference use this https://github.com/JayEffTree/Ayaya-Bot/blob/master/src/utils/embeds.js
How come my SQL database can not be awaited using Javascript?
@vale garden
@magic jackal i got this
@peak venture Need more context then that
ofcourse
@long yew show me what is on that line 168
@long yew your index.js has some missing brackets or unclosed blocks
so i was trying to search the database and then continue working with the command
Though the command goes on and does not await my db.query(`SELECT...
@peak venture which library
nodejs
i mean database library
library
libraryy
mysql from npm?
const collector = message.channel.createMessageCollector(filter, { time: 15000}, {max: 1})
uhu
Then no 
@peak venture i dont see promises in their docs
@vale garden posting in here "it isnt working" doesn't help, send errors and where its crashing
@magic jackal i fixed it and got this
@quartz kindle means it can not be used to await hm?
show server.js
@quartz kindle sir, it is my server.js: https://hasteb.in/nivovowu.js
@long yew Still can't do anything with that, there is still missing brackets or something
can i not work around using a function and await that function?
you will need to promisify the callbacks yourself
@magic jackal what line?
ah. thats an option aswell
@peak venture ```js
await new Promise(resolve => {
db.fetch(..., result => {
resolve(result)
})
})
i fixed it
k
nice
@magic jackal
anyone know what permission is required to delete emotes from a message?
that block is not closed
Your editing someone else's message too
youre missing the closing brackets
Message.edit is editing the inputed message
there is alot of stuff wrong there
@long yew
fixed here
I think you should read through the docs more, this is the example file and you're getting into stuff you don't understand yet
@heavy pollen 2 things you can do. init().catch(console.log) and client.on("debug",console.log)
@magic jackal ok ty
that should help you find the problem
ur a pro
mhm

that should help you find the problem
@quartz kindle my sharding is true?
@magic jackal i'm sorry to ask you again but i got an error
messageEmbed is out of scope
/invite
messageEmbed is out of scope
means
its outside of the if statment
that does not work
:/ español?
dont spoonfeed too much
español en #memes-and-media
Ok
currently spamming 429 hit on route /gateway/bot @quartz kindle
where is your bot hosted?
@magic jackal ty so much i've been trying to add embeds for so long
try to learn and understand what the code means
just so you dont keep copying and pasting whatever people give you
where is your bot hosted?
@quartz kindle in vps, 6gb ram turkey location
its spamming now too
you might have been banned by discord
i never see a problem in v11
you might have been banned by discord
@quartz kindle i can open bot with v11
they usually ban for 1 hour, if your bot makes too many invalid requests
try with only 1 shard
that usually means discord is temporarily blocking you
if your v11 also in the same vps?
if your v11 also in the same vps?
@quartz kindle yes, and there is a new error: https://hasteb.in/icezahop.cs
you need to specify total shards to start only one
for example totalShards:4
then manager.spawn(1)
I write 2 to totalShards
https://gyazo.com/efc8040a4b1abae89d4c20a2f00561de where did i mess up my music bot queue pls dm me
later i need to write manager.spawn() or manager.spawn(1) or manager.spawn(manager.totalShards)
manager.spawn() = spawn all shards
if you want to test only 1 shard, then manager.spawn(1)
wow i understood now..
can someone pls help me with my music bot queue where did i mess it up
zd
its the same bot, but seperated in a way that lets it handle more load
there are many ways to shard, it can be done all inside the same process and have it handle multiple websockets, or have it in separate processes to make use of multithreading
each shard will be assigned a certain number of guilds out of the total guilds your bot is in
and will only handle events for those guilds
shard with cluster?
cluster is the same thing as separate processes
so, i don't need to use it right?
not necessarily, but depends what you want to do
if you have a machine with multiple cpu cores, traditional sharding is better for you, doesnt matter if sharding manager, child processes, cluster... its all the same thing
Ok,thx.
helpme(discord.js)
code:
bot.on('message', async msg => {
let args = msg.content.substring(PREFIX.length).split(" ");
let _command = msg.content.toLowerCase()
if (!_command.startsWith(PREFIX)) return;
let snipes = require("./commands/snipe.json");
let chn = `${msg.channel.id}`;
var snipechannel = snipes[chn];
function random_item(snipeResponse) {
return snipeResponse[Math.floor(Math.random() * snipeResponse.length)];
}
var snipeResponse = [
"Lma9 there\'s no ammo left",
"Hah there's nothing there",
"He's got an ubered medic :(",
"AAAAAAAAAAAAAAAAAAAAAA (there's nothing to snipe, idiot)",
"Jsjsjsjsjsjsjsjssjsjsjsjsjajherfiuow34gheoiufgweqiurygtfogiuys",
"Are you going to learn how to aim or what lol",
"I cAnT FiNd tHaT uSeR",
"First you must fall before you can rise",
"Delete it first lol",
"Use brein and de-1337 a message",
"Stop trying and let MEEEEEEEE do it\n`aa!purge 99`",
"Aeugh",
"Imrunningoutofideas (delete a message l o l)",
":pog:lete a message",
"Are you okay?",
"https://www.delete.com",
"pls snipe sux",
"rubrubrubrubrub DELETE",
"Nomthimng to snimpe!",
"But nobody came...",
"`De le te th em es sa ge`",
"msg.delete()",
"oHnoTheLoGiSeMpTy!!!!"
]
var dateA = new Date(snipechannel[2]);
var timeA = (`${dateA.getHours}:${dateA.getMinutes}`);
switch (args[0]) {
case 'snipe':
if (snipechannel[0] === "NaN") {
msg.channel.send(random_item(snipeResponse))
} else {
msg.channel.send(`${snipechannel[1]} said:\n` + "```" + snipechannel[0] + "```\nAt " + JSON.stringify(timeA()))
}
snipechannel[0] = "NaN";
break;
}
})
And here is error:
(node:17672) UnhandledPromiseRejectionWarning: TypeError: timeA is not a function
aaaaaaa
idk how necessary this is but uh
:3
Which is the function who show all the members , even if they are offline, in a server with 1000+ members? Please? actually i'm noob
can anyone help me with a basic poll command?
ohshit-
@long hare guild.memberCount in discord.js
thats not a valid function how you're calling it
yep, in discord.js
can anyone help me with a basic poll command that i can work on?
can anyone help me with a basic poll command?
msg.react(' ').then(() => msg.react(' '));
@long yew i can make that command, if you need
yes please
i just did uwu
ok, right now
@pure lion it needs to copy what i say
accept the friend request
o h
it is simple
@long yew We are not here to spoonfeed you
Please look at the DiscordJS docs and get yourself situated with how the lib works
2-3 weeks
So, the GUILD_MEMBERS intent is only for getting a lot of users?
the intent controls whether or not you receive guild member events and data
for example, guildMemberAdd, guildMemberUpdate, guildMemberRemove
or fetching members
also the initial members that come with the guild at login
getting someone tagged in a message wouldnt be under that correct?
no, messages still contain member data
sweet thanks
no, messages still contain member data
@quartz kindle sir can i show my code to you
Why its not working
Im trying same codes with another bot
It works
hello
small help
let spawns = [
"https://cdn.bulbagarden.net/upload/thumb/2/21/001Bulbasaur.png/250px-001Bulbasaur.png" ]
module.exports = {
name: "spawn",
category: "info",
description: "spawning a pokemon by devs",
run: async (bot, message, args) => {
let spawn = spawns[Math.floor(Math.random() * spawns.length - 1)];
let Embed = new MessageEmbed()
.setTitle(`8Ball!`)
.setDescription(spawn)
.setColor(`RANDOM`);
message.channel.send(Embed)
}
};```
is that the way of spawning
or is there another way where we can make each type pokemon spawn within a given spawn rate
plz ping and reply
thats for testing only
please say
someone
What are you trying to do?
So it needs to just send the picture?
"https://cdn.bulbagarden.net/upload/thumb/2/21/001Bulbasaur.png/250px-001Bulbasaur.png" ]```that kinda thingy
or is there another way where we can make each type pokemon spawn within a given spawn rate
@acoustic kiln use setInterval
@spark breach yes of course and within some sort of time limit
@summer torrent can you tell the actual line where i have to do
plzz
What I could think off is you save the image in a folder you have in your bot folder, then make a code that makes it random which one it picks
no one will spoonfeed you
@spark breach should i save all pokemons in a folder nd use that one
yeah
save all of them in 1 folder
number them like 1 to idk how many pokemons there are
yea
and then make it random which one it picks
800+
yea
I mean like the basics, charmander, charmeleon, snorlax etc
Is there a list of all the images you can create with that flip note api?
@spark breach is it like open folder--save all pokemons--rename 1,2,3,4--upload it--
type
numbers extra convenience
so from the number 1-100 it picks a random one
numbers extra convenience
Yeah you can use a math code
Is there a list of all the images you can create with that flip note api?
discordjs is not a language
Anyone know how to move from mongodb localhost to mongodb cluster
which lib
discord.js
Anyone know how to move data from mongodb localhost to mongodb cluster
How can i Make a number counter?
so whenever someone reacts to a message it sends message following the queue from 1 to 2 to 3
sorry If I didn't explain well 😦
which language
you can use loop
Is it possible to move from mongo dB local to a cluster without manually moving all data?
I found this https://stackoverflow.com/questions/21303456/migrate-mongodb-database-from-localhost-to-remote-servers
https://www.mongodb.com/blog/post/migrating-data-to-mongodb-atlas this is right from mongo and is for atlas, but may help you in importing/exporting your db
oh
Yeah I want to move from local to atlas
anyone know how to use aiohttp?
no but you can read docs and you can be the one that knows 👀
I was using requests and built a small class system that I could call easily to perform post and get requests. But since it's causing "blocking" I was told to move over to aiohttp.
it did?
i got error
Error: Cannot find module 'discord.js'
Require stack:
- /app/server.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:610:15)
at Function.Module._load (internal/modules/cjs/loader.js:526:27)
at Module.require (internal/modules/cjs/loader.js:666:19)
at require (internal/modules/cjs/helpers.js:16:16)
at Object.<anonymous> (/app/server.js:1:34)
at Module._compile (internal/modules/cjs/loader.js:759:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
at Module.load (internal/modules/cjs/loader.js:628:32)
at Function.Module._load (internal/modules/cjs/loader.js:555:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:826:10)```
Install discord.js
check ur package.json
whats your package.json look like
i have
🤔
you're laughing but ur the one getting the error lul
i thing it is an system error i have to reinstall all
ok thanks
installing package.json again
@digital ibex thanks
working
but it taken 20 to 30 mins
So I bought this database from strato but cant seem to figure out how to use it in nodejs via mysql
what database r u using?
what do you mean exactl7u
u bought what database from strato?
Okay so i have a package I made right? it has two dependencies, nodefetch and prismarine nbt
prismarine nbt has 1 dependencies and that dependecy has a long chain
when I downloaded prismarine nbt, it downloaded the other dependcies in the chain.
Can I remove the ones in the chain and only keep nodefetch prismarinenbt in my packagelock json
my dad bought it for me
pretty sure it is just the basic sharded one]
@digital ibex
do you need to pay for a mysql database ?
you can
also free?
i've never worked with mysql, only nosql
yeah, my db is free, only because im hosting on it on my pc, so i don't have to pay for it
does it go offline if you turn your pc off ?
Hi! Is anyone getting this error message? (node:6240) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.
at Client.login (C:\Users\bertr\OneDrive\Desktop\Documents\GitHub\ReliaBot\ReliaBot\node_modules\discord.js\src\client\Client.js:204:52)
at Object.<anonymous> (C:\Users\bertr\OneDrive\Desktop\Documents\GitHub\ReliaBot\ReliaBot\index.js:6:8)
at Module._compile (internal/modules/cjs/loader.js:1200:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
at Module.load (internal/modules/cjs/loader.js:1049:32)
at Function.Module._load (internal/modules/cjs/loader.js:937:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
(Use node --trace-warnings ... to show where the warning was created)
(node:6240) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:6240) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
not a valid token
I am sure that the token is correct
what you mean
so host ur bot and ur db on the same place
Same
this should help, https://www.hostinger.co.uk/tutorials/what-is-localhost
In computer networking, localhost refers to a computer running a program; in which the computer works as a virtual server.
Why is it saying this when the token is correct:
(node:6240) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.
at Client.login (C:\Users\bertr\OneDrive\Desktop\Documents\GitHub\ReliaBot\ReliaBot\node_modules\discord.js\src\client\Client.js:204:52)
at Object.<anonymous> (C:\Users\bertr\OneDrive\Desktop\Documents\GitHub\ReliaBot\ReliaBot\index.js:6:8)
at Module._compile (internal/modules/cjs/loader.js:1200:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
at Module.load (internal/modules/cjs/loader.js:1049:32)
at Function.Module._load (internal/modules/cjs/loader.js:937:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
(Use node --trace-warnings ... to show where the warning was created)
(node:6240) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:6240) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
theres no need to send it twice or send the error stack.... just regen ur token and save it again
PLEASE use code blocks or ghostbin
Ok
but will the database work if my pc is off
and u dont have to send the WHOLe error
@earnest phoenix no, have u got a host?
I only have a VPS where i host my discord bot
then u can host it there
VPS's can do multiple things at once
really fucking confused here, but I have this code that checks if a mongoose model exists or not (model is LikedSong), if not then make one, but it always returns true even if there is literally no collection in my db with the criteria ```js
//checking if user has liked a song before
if(LikedSong.exists({userID: ${user.id}})) {
console.log('User has a document for liked songs');
LikedSong.findOne({userID: ${message.member.id.toString()}}, 'likedSongs', function (err, songsDoc) {
if (songsDoc.likedSongs.includes(${currentSong})) {
message.reply("Looks like you've already liked that one mate!");
return;
} else {
//pushing song to their arr
songsDoc.likedSongs.push("${currentSong}");
songsDoc.save();
}
});
} else {
//creating database entry and
//pushing to db
const pushSong = new LikedSong({userID: ${user.id}, likedSongs: []});
pushSong.likedSongs.push("${currentSong}");
pushSong.save();
}
How can I do that @digital ibex
are u using mongo? You just dl mongo server and run it
you don't need to do anything, just add the code there and boom
you can do if(!ilkedSong) { likedSong = { };
maddie ^
for mongoose?
ur issues got nothing to do with mongoose lol
how can i set a custom status with discord.js v12?
okay, thank you
you can do
if(!ilkedSong) { likedSong = { };
@digital ibex yeah, but I wanna check if a collection exists for a certain user, not if there's just one in general
you wanna check for a collection?
yeah, checking if theres a collection with a value userID: `${user.id}`
just for reference, you're gonna use A LOT of ram and storage creating collections for each user
but you'd do the same, if (!collection) { collection = new <Model>{} }
im using an atlas cluster, but what would be the best way to save it?
in a collection called users or members, and in that include documents
and how would I specify the collection criteria?
wait
that might be what im doing
yeah, nvm i have a db, and within a collection i have documents
How can I host a local MySQL server on a VPS?
sry im new to mongo!
How can I host a local MySQL server on a VPS?
@earnest phoenix google?
ah
well, i'd do something like this: js const Model = model; const user = model.findOne({ userID: user id }); if (!user) { user = new Model({ store whatever default data for ur user }); await model.save(); } else { user = { user } }
assuming ur using es6 you can do the user = { user }bit, otherwise u'd do user: user
well, thats es6, what its doing is whatever user is, thats what it is ig lol, and the no : is es6 only
whatcha need?
im dying i just want this pain to end
um
what lib?
bot.on('message', async msg => {
let args = msg.content.substring(PREFIX.length).split(" ");
let _command = msg.content.toLowerCase()
if (!_command.startsWith(PREFIX)) return;
let muterole = msg.mentions.roles.first()
var muteroles = require("./commands/muteroles.json");
muteroles[`${msg.guild.id}`] = [`${muterole}`];
let gld = `${msg.guild.id}`;
var glds = muteroles[gld];
switch(args[0]) {
case 'muteroleset':
glds[1] = muterole.id.toString()
fs.writeFile(muteroles, JSON.stringify(muteroles, null, 1)),function (error) {
if (error) {
return console.log('oops')
}
}
}})
^ code (discord.js)
(node:8072) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_CALLBACK]: Callback must be a function. Received undefined
error
add the function (error)... bit in the parenthesis
parenthesis
?
eh, it'd probably still error
i feel like i should know this, are they brackets like ()?
( and ) are parentheses
brackets are []
y- o
is it considered advertising if i send a glitch forum post to get support
what if you try
fs.writeFile(muteroles, JSON.stringify(muteroles, null, 1), (err) => {
if(err) console.error(err)
})
basically the same thing, but using an arrow function
oh hey steven
aightttttt
(node:17672) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received an instance of Object
p r o g r e s s
wheres that coming from?
at writeFile
i mean, the arrow function bit?
How can I host a local MySQL server on a VPS?
.writeFile
^
here
hi
I don't think there is a site similar to glitch
importthefiles?
¯_(ツ)_/¯
i did?
thats what the error says
what would i need to turn into a string-
its not about turning it into a string
its probably just that you did something wrong in the first place
ugh
would help if you showed code
scroll up
muteroles is an object
writeFile wants to know the path of the file to write, ie: directory and file name.
youre giving it an object, ie: "save my file in [object Object]" instead of "save my file in /folder/file.json"
you didnt
fs.writeFile(muteroles, JSON.stringify(muteroles, null, 1)),function (error) {
where is the path? folder and file name
when are the votes reset?
1st day of every month
uh problem
I think the error messasge explains it pretty well
Yep
in <style> tag
ah ok
ty
how do i do this with images?
is it possible to upload images from my pc?
no
yes and no
use image uploaders
imgur, etc.
ok
with open('prefixes.json', 'r') as f:
prefixes = json.load(f)
return prefixes [str(message.guild.id)]
client = commands.Bot(command_prefix = get_prefix)
@client.remove_command('help')
@client.event
async def on_guild_join(guild):
with open('prefixes.json', 'r') as f:
prefixes = json.load(f)
prefixes[str(guild.id)] = '/'
with open('prefixes.json', 'w') as f:
json.dump(prefixes, f, indent=4)
@client.event
async def on_guild_remove(guild):
with open('prefixes.json', 'r') as f:
prefixes = json.load(f)
prefixes.pop(str(guild.id))
with open('prefixes.json', 'w') as f:
json.dump(prefixes, f, indent=4)
@client.command()
async def prefix(ctx, prefixes):
with open('prefixes.json', 'r') as f:
prefixes = json.load(f)
prefixes[str(ctx.guild.id)] = prefixes
with open('prefixes.json', 'w') as f:
json.dump(prefixes, f, indent=4)
await ctx.send(f'I changed the prefix to: {prefixes}')```
Why is this not working? 🤔
cant tell ya cause i use discord.js
i use javascript
wow, very useful. information!
yes
wdym
On each event emit
Sure
Traceback (most recent call last):
File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\client.py", line 312, in _run_event
await coro(*args, **kwargs)
File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\bot.py", line 930, in on_message
await self.process_commands(message)
File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\bot.py", line 926, in process_commands
ctx = await self.get_context(message)
File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\bot.py", line 842, in get_context
prefix = await self.get_prefix(message)
File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\bot.py", line 787, in get_prefix
ret = await discord.utils.maybe_coroutine(prefix, self, message)
File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\utils.py", line 317, in maybe_coroutine
value = f(*args, **kwargs)
File "C:\Users\Lenovo\Desktop\rareh\rareh.py", line 16, in get_prefix
return prefixes [str(message.guild.id)]
KeyError: '110373943822540800'```
Well it's a keyerror
Meaning a key with that ID doesn't exist
Therefore, you don't have a set prefix for that server
Either add it manually or handle such cases automatically
Error: Error: Cannot find module '/root/bot/node_modules/@discordjs/opus/prebuild/node-v67-napi-v3-linux-x64-glibc-2.27/opus.node'
0|bot | Error: Cannot find module 'node-opus'
0|bot | Error: Cannot find module 'opusscript'
either use dictionary.get or a try-except with the way you're doing it. Also, please, use cache for prefixes.
newUser = {
"money" : 0,
"boost" : 1,
"cooldown" : 0,
"job" : "",
"item" : ""
}
users[userID] = newUser
Can i use this thing?
like
to make it work?
I mean, i will change it for sure 😛
That's possible
Fall back to a default prefix if custom one wasn't found and save it
Preferably use .get with the dictionary you're getting
Can u tell me please what i need to change in
newUser = {
"money" : 0,
"boost" : 1,
"cooldown" : 0,
"job" : "",
"item" : ""
}
users[userID] = newUser
How is it related to the code snippet you sent before
how do i access the data from the flipnote steam link?
keep getting node-pre-gyp: Permission denied when trying to install something on vps
elevate it with sudo or give your user proper permissions
how can i give myself permissions
@earnest phoenix usermod if ur on linux
im on linux yes
also you prolly should learn more bash if you're running a vps
what do i need to type in
use the usermod command
ye si logged in as root
you shouldn't do that on a production server....
should i make a new user
but anyways if ur on root, just run sudo npm i whatever package u want
id reccomend it yes, but you'll hafta migrate ur files if u wanna easily access them
srsly, learn bash
did u use sudo
sudo npm i @discordjs/opus
also do u have ur build tools installed? idk if opus needs them or not
what do you mean with build tools
also what lunux distro are u using?
build tools allows modules to be built from source code
im using Ubuntu 18.04 x64
mkay
why cant i have perms to do stuff
real quick, what happens when u try and run the su command
if you're root then you should have perms
root should have every perm 🤔
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
but it worked before
i resetted it and now imma tryna get my bot up and running again
but dont have perms for some reason
how do i start a python bot lol
python <ur bot file>.py
can someone help me i need help with JSON shit and aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
dm please
ok ty
maddie what can i do
Just state your issue
^^^
You didn't need to post all the a's either tbh
Spamming a is not gonna help
i wanna get a role ID from a json but its not working
I don’t believe python can integrate with json files :/
@earnest phoenix is it a fresh vps, or did u just remove ur old files from it
All langs can integrate with json
i think python can with proper packages
It's just a data format
@earnest phoenix is it a fresh vps, or did u just remove ur old files from it
i completely resetted it
so it is pretty much fresh
reinstall
you reinstalled the os
yes it does that automatically
mkay
i mean if u want
but first
what happens when u try running sudo
does it ask you for a password?
I forgot to put my bot online this morning and now I can’t put it on until tomorrow afternoon
( I’ve gone camping )
usage: sudo -h | -K | -k | -V
usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]
usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user]
[command]
usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p
prompt] [-T timeout] [-u user] [VAR=value] [-i|-s] [<command>]
usage: sudo -e [-AknS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p
prompt] [-T timeout] [-u user] file ...
I’m on Mac so I can’t help you
mac is linux based????
Not really
but nvm lol
MacBooks are mainly used for music production and Linux is mostly used for coding
I forgot to put my bot online this morning and now I can’t put it on until tomorrow afternoon :pepesadboi: ( I’ve gone camping )
@earnest phoenix are u using a vps?
Nope
damn, was gonna say u could just ssh
Lol
i just installed things
With my bot atm I’m working on making a stats page for Minecraft server stats
i just installed things
@earnest phoenix did it work?
With my bot atm I’m working on making a stats page for Minecraft server stats
@earnest phoenix o nice
i installed it in the wrong folder
i cant install things in the /bot
im missing permns there
what are the permissions for the directory?
google it, then allow read/write access with chmod
srsly pls learn bash or just google stuff, it'll help u work so much quicker
can you tell me how i can allow read/write
Google it?
fine fine
dont understand why you cant help m
sudo chmod -R 777 /bot
help is donated, we are people too, with our own projects
"chmod: cannot access '/bot': No such file or directory"
that folder doesnt exist
What is this problem?
Can't find the module you're requiring
canvas requires some extra things on windows
what permission is used for unbanning?
BAN_MEMBERS
assumed so
ty
and how do you unban someone
if there's no way to get the guildmember
fetch from bans
pretty sure you can guild.members.unban(id)
^

