#development
1 messages · Page 997 of 1
It'd be a check inside a "onReactionAdd" event
i found what i was looking for
but
i'm not sure what the constructor is
or whatever it's called lmao
If you just want the user that's in the DM channel use message.channel.recipient
As in the message that the bot sent.
message.author.id==client.user.id?true:false
reaction.users.cache.fetch([options])
okay thx
@lyric mountain That checks if it is by any bot, not the current bot
He wants to ignore bots
^
Not specifically his own bot
thx m8
he wants to check if the message is by a bot that has reactions?
Or he wants to check if a bot made a reaction?
because he gotta loop through a fetch still
He probably want to ignore bot reactions
ah
Most likely to be used in reaction buttons
to check if the current bot gave the reaction is reaction.me
Otherwise you gotta loop through it
Right?
I don't see anything else than the users cache.
That's reaction.users.cache
\:tickYes: it's not working
https://hastebin.com/dadayozina.js
(node:12008) UnhandledPromiseRejectionWarning: TypeError: ReactionModel is not a function
at module.exports.run (C:\Users\kenra\Desktop\Frosty Rewrite\src\commands\Utilities\rradd.js:41:22)
help
pls
i've asked so many times
I need to extract custom emojis id
use the emoji, right click, copy link and that last part, that big number
emoji id

https://cdn.discordapp.com/emojis/315009125694177281.png?v=1 thats the link
and 315009125694177281 is the id
module.exports = (client, message) => {
if (message.author.bot) return // If the author of the message is a bot, it will not react
if (!message.content.startsWith(client.config.prefix)) return // If the message doesn't start with the prefix in config.json, do not react
const args = message.content.slice(1).split(" ") // Separates the message into multiple parts
const command = args.shift().toLowerCase() // Remove the command from the message parts and puts it here
const cmd = client.commands.get(command) || client.commands.get(client.commandAliases.get(command)) // Get the command or an alias
if (cmd) {
cmd.run(client, message, args) // Runs the command
}
}``` https://cdn.discordapp.com/attachments/708092603329019964/726209489698684978/unknown.png
Can someone help with this?
rule 1: dont use glitch
Whats glitch?
something that looks like what u use rn but it actually isnt im sorry
oki
No that’s heroku
rule 2: module.exports = {run(client,message,args) {/*code*/}} is the correct formula for your command files
uh
well
but dyk how to fix my issue
i just told you how
you told me a rule
OH
HOHH
HOH
HOH
you have a wrong format somewhere in your commands
so the run function doesnt exist
prob in my new command
so the code nopes the fuc out
ill send
exports.info = {
aliases: ["helpserver"]
}
const Discord = require("discord.js")
const server = new Discord.MessageEmbed()
.setTitle("Code Box")
.setDescription("Code box's are displayed like this \n \n ` ```
thats my newest code
wait what
that i mean
oop
ik
it should work like that tho
exports.info = {
aliases: ["helpserver"]
}
const Discord = require("discord.js")
const server = new Discord.MessageEmbed()
.setTitle("Code Box")
.setDescription("Code box's are displayed like this \n \n ` ```js \n your code here \n ``` `")
.setFooter("Thanks!")
.setColor('#d966ff')
exports.run = (client, message, args) => {
if (args.length > 0) {
message.channel.send(server)
return;
}
message.channel.send(server)
}```
ill just send a ss
No that should be fine
what command returns that error
well since that error
none of my commands work
https://hastebin.com/dadayozina.js
(node:12008) UnhandledPromiseRejectionWarning: TypeError: ReactionModel is not a function
at module.exports.run (C:\Users\kenra\Desktop\Frosty Rewrite\src\commands\Utilities\rradd.js:41:22)
9th time asking for help
i would like the file ../../models/ReactionRole please @hardy vector
also @earnest phoenix you can try to log what your bot is doing at the moment when the error occurs
maybe try logging cmd to identify which one causes the issue or smthing
alr
first command thats broken
OH SHIT
LMAO I SAW WHAT I DID
now it should work
wüt
@hardy vector i have one question
how are we supposed to help when you wont let us help
my code was like this
`exports.info = {
aliases: ["inv"]
}
const Discord = require("discord.js")
const invite = new Discord.MessageEmbed()
.setTitle("Invite")
.setDescription("**Invite Token bot to your server!**\n \n[**➡Invite**](https://discord.com/api/oauth2/authorize?client_id=722347892156661770&permissions=8&scope=bot)")
.setFooter("Thanks!")
.setColor('#d966ff')
exports.run = (client, message, args) => {
if (args.length > 0) {
message.channel.send(invite)
return;
}
message.channel.send(invite)
}````
its all quoted
it is
mhm
lmao
does anyone know how to collect reactions to edit a already sent embed
message.author.send(inviteembed);
module.exports.help = {
name: "invite"
};```
It says **`message` is not defined**
Full Code:
// at the top of your file
const Discord = require('discord.js');
// inside a command, event listener, etc.
const inviteEmbed = new Discord.MessageEmbed()
.setColor('#0099ff')
.setTitle('Invite Me!')
.setURL(`https://discord.com/api/oauth2/authorize?client_id=721960016168353792&permissions=8&scope=bot`)
.setAuthor('Moderation Bot', 'https://media.discordapp.net/attachments/722094309834227802/722146956260147321/New_Project_-_2020-06-15T122119.065.png?width=269&height=224', 'https://discord.com/api/oauth2/authorize?client_id=721960016168353792&permissions=8&scope=bot')
.setDescription('Some description here')
.setThumbnail('https://i.imgur.com/wSTFkRM.png')
.addFields(
{ name: 'What is Moderation (101)?', value: 'Moderation 101 is a advanced moderation bot more suffisticated than any other.' },
{ name: '\u200B', value: '\u200B' },
{ name: 'Moderation', value: `Cool moderation bot more advanced than any on discord.`, inline: true },
{ name: 'Fun Commands', value: 'Cool fun commands to use in your server.', inline: true },
)
.addField('Thanks for reading!', 'Done forget to add me!', true)
.setImage('https://media.discordapp.net/attachments/721189811851100171/722139773501964298/unknown.png?width=776&height=200')
.setTimestamp()
.setFooter('Show some support by adding me!', 'https://media.discordapp.net/attachments/721189811851100171/722139773501964298/unknown.png?width=776&height=200');
message.author.send(inviteembed);
module.exports.help = {
name: "invite"
};```
I am confused on what you are trying to accomplish
you didnt define message
.. O_o
yeah where tf is the message variable initialized
it is not, which is the error. What is the name of the file you wrote this in?
and is it a command? or just a response?
it looks like it was just copied from some guide given the comments
I thought it was obvious
bruh chill
no need to spam
anyone know the cheapest way to host a bot?
many people use glitch
glitch banned ping services
I am currently using glitch but the 5 min thing is kinda dumb ^
so its not really a choice now
https://discordapp.com/channels/264445053596991498/272764566411149314/576818380498010112
choose one that is in your range
okay
there is still Heroku
?
yeah wouldnt recommend freebies
https://hastebin.com/dadayozina.js
(node:12008) UnhandledPromiseRejectionWarning: TypeError: ReactionModel is not a function
at module.exports.run (C:\Users\kenra\Desktop\Frosty Rewrite\src\commands\Utilities\rradd.js:41:22)
did you export your ReactionModel? in your Model.js?
@hardy vector I told you already, if you wont let us help we CANT HELP YOU
wot
I asked you for your reactionrole file thingy
module.exports.run = async () => {
const mongoose = require("mongoose");
const schema = new mongoose.Schema({
Guild: String,
MessageID: String,
Reaction: String,
Role: String,
})
const model = mongoose.model("ReactionRole", schema)
module.exports = model
}```?
my model?
do you see whats wrong here
do you see it
ill point it out
2 module exports
to the same export path
oh
nerdthatnoonelikes
so i can remove module.exports = model??
how do you know so much about me
wot?
just run node .
so i can remove module.exports = model??
bruh no
How to make the bot online to discord successfully
ffs just do node <name of main file>
supply a valid key to client.login and run it with node .
Show me how
^
Discord = require("discord.js");
const client = new Discord.Client();
client.login(YOURKEY)
@earnest phoenix sry if im not talking straight its 11pm here and i didnt sleep last night
enrgish 10/10
me?
its 5am for me
same
What's for discord cilent
?
does anyone know how to collect reactions to edit a already sent embed
@02Desired#4365
you could use the reactionAdd event
@earnest phoenix wait so what do i do tho if i need to access the model in other files
Which would i fill in
without exporting it
you export it twice that is the issue
const mongoose = require('mongoose');
const guildSchema = mongoose.Schema({
_id: mongoose.Schema.Types.ObjectId,
guildID: String,
prefix: String,
tradechannelid: String,
startingbid: Number,
maxminbid: Number
});
module.exports = mongoose.model('Guild', guildSchema);
``` this is a working model
Man..tech is hard
you give us 0 informations about what your issue is. so we cant help you
Discord = require("discord.js");
const client = new Discord.Client();
client.login(YOURKEY)
Which of this do i need to fill in
Token?
yes
Where can i find mainfile
did you know anything about javascript?
No..it is first time
learn it first. otherwise it makes no sense
Node.js?
js
The link
ngl i learnt node.js from making a discord bot
my first bot was literal garbage
i learned javascript from reading source code on github
my bot is fixed, praise jesus
jesus is dead
that turned dark in a split second
my 6 kids in the basement are screaming one sec
use \n for a new line
or use async code
then make await send a
await send b
await send c
ok
add at the end of your first message \n then copy your second behind it then again \n and then copy the 3rd behind it (its one string not 3)
message
so in the ""
message.channel.send(`Message1\n Message2\n Message3`)
more infos?
what version of linux does heroku use >
If i use vps..is it free access without do anything about vps just add command?
learn mode javascript until you know what is wrong with your last message @dusk sphinx
what version of linux does heroku use >
@lusty quest any idea bout this ?
i never used Heroku. i dont trust Free hardware
lol
i am making a bot called gear, still in work in progress, has some moderation, fun commands and more. Very happy to be in the bot making community 🙂
How find custom emojis id ? Previously I used \:email:
yo
should be the same
is this the place to ask for someone to help me test my bot
nice @earnest phoenix, welcome (i cant b speaking i dont even have green)
Thanks 🙂
can anyone help me in making my first bot cmd ..js
@shut wolf https://discordjs.guide/
@robust moth copy the link of the emoji, the string of numbers in the link is the emoji ID
@robust moth easy way to do it is by copying and pasting the emoji into ``
like this: 
then the id is the numbers in the string
or you can just right click the emoji and click copy id LMAO

@jovial sentinel what language is it in
hm
Anyone know how to get a bot (Discord.js) to send a message through a premade webhook?
Like fetch or whatever
like how NQN does but not python(?)
like this:
:AYAYA:
@earnest phoenix I know .
But previously I used\:emoji:it
It's execute emoji id
oh wait this probs isn't the right channel for me to ask questions ;P sorry
it is mine
ok.
but it isn't anything special :P
you tell us
@earnest phoenix you can do a post request to the webhook url, with the correct payload, or you can use d.js's built in webhook manager
it is not sending message in channel syaing kicked him
go debug your code
go debug your code
@earnest phoenix it says all fine
lmfao
@copper cradle yes, i know if i had the url made and knew the url how to get one sent... how ever lets say someone (User) is using the bot to send a webhook and doesnt want to set one up but use it...
Making a command like: !say [message] sends a users message with their name and such for example
I may have misexplained that^ but would i need some DB maybe to store it?
or can i just do like how i fetch channels somehow? O.O
you'll need to store that webhook's url then
ah. ok
if (!msg.member.hasPermission("KICK_MEMBERS"))
return msg.reply("*_Sorry, you don't have permissions to use this!_* :frowning: ");
let member = msg.mentions.members.first() || msg.guild.members.get(args[0]);
if (!member)
return msg.reply("__Please mention a valid member of this server__");
if (!member.kickable)
return msg.reply(
"*I cannot kick this user! Do they have a higher role? Do I have kick permissions?*"
);
// slice(1) removes the first part, which here should be the user mention or ID
// join(' ') takes all the various parts to make it a single string.
let reason = args.slice(2).join(" ");
if (!reason) reason = "No reason provided";
await member
.kick(reason)
.catch(error =>
msg.reply(`**Sorry ${msg.author} I couldn't kick because of : ${error}**`)
);
msg.channel.send(
`**${member.user.tag} has been kicked by ${msg.author.tag} because: ${reason}**`
);
}```
according to me
there is nothing wrong here
according to me
I'm no wizzard to instantly know what problem you're having
ah not providing a reason?
he is not sending the message even
im dumb at this
ok
but like i think you might have to like save the reason as a variable unless you already did
uh...
he did:
let reason = args.slice(2).join(" ");
wait
oh i cant read oml
msg.member.send << is this code correct ? for dming the guy who got banned? or kicked
prolly cuz im dumb
ok
cos then its msg.msg.mentions.members.first()
send the message before banning the member
and make sure to check if the member has their dms open
How can I embed my website in discord? When I send a link, that there is a embed below there
send the message before banning the member
@copper cradle kkk
@radiant estuary meta-tags
O think discord uses og tags
lemme get a link to that
Witch?
witch
how to give that
I have some. Dont work
guild name
WHAT SORT OF WITCHERY IS THIS?!
Sry, i am not good in english
what is it
@radiant estuary https://ahrefs.com/blog/open-graph-meta-tags/
Thx
like you have been kicked from {member.guild}
@delicate shore
member.send(`Sup, you been kicked from ${message.guild.name}`).catch(e =>{ console.log(`${error}`)}).then(member
.kick(reason))```
I may be very wrong
i think so
wait...
message is the message from the guild. So you can get the guild Name 😉
can't i simply do this
member.send("You have been kicked from ${message.guild.name} because of ${reason}")
Yes
for the message yes...
but catch is so if theres an error
i will do that
Then you have to change and replace this
What do you use for message? Do you write message, oder e.g. msg?
msg
Okay, then msg.guild.name
that ik
Ok
error is not defined
?
oh i use e
for error
lol
member.send("You have been kicked from ${msg.guild.name} because of ${reason}").catch(e =>{ console.log(`${e}`)})
is this correct?
in the () after .send put the text in ``
ok
Then that should be fine
ok
Discord doesn't load my website. Can somebody help me pls
Hello I would like to create a dashboard for my discord bot. Could you help me?
Hello I would like to create a dashboard for my discord bot. Could you help me?
@earnest phoenix
https://dontasktoask.com/
Discord doesn't load my website. Can somebody help me pls
@radiant estuary
elaborate
how do i make cooldowns
like
5 secs time between commands
if less than that bot wont respond
https://discordjs.guide/ they have a tutorial
ok ty
you don't know if they're using d.js
im using discord.js
oh
xD
tldr
create some sort of a list of ids
then on command execution put the user id in the map
in js you can then use setTimeout to remove the user from the map
on every command execution check if the user id is inside of the map, if it is then the user is on cooldown
kk
you can optimize this by not queueing a fuckton of timeouts but rather having some sort of a timer/interval running checking for entries every second
i have too smol brain to understand that
but i will try the link
and learn more js
working on my bot website
does this mean im going back to the queue
wot?
where?
client.on("message", (message) => {
if (!message.content.startsWith(prefix) || message.author.bot) return;
if (!message.member.hasPermission("BAN_MEMBERS")) {
message.channel.send("You don't have permission to use this command!")
} else if (message.content.startsWith(`${prefix}ban`)) {
let member = message.mentions.members.first();
member.ban()
message.channel.send(member.displayName + " has been kicked! :door:")
}
})
Can someone help me why does my bot do that?
@fresh hatch wdym
the bot responds to every message with "You don't have permission to use this command!"
Make a logic draw
it will help you
Prefix :
Check Ban permission :
else If messagee startsWith prefix and ban :
The error is that you verify if the sender has the permission before checkinf if the command nedd the ban permission
So the ban will be executed only if the person doesn't have the ban permission because of your else
if (!message.content.startsWith(prefix) || message.author.bot) return;
if (message.content.startsWith(`${prefix}ban`)) {
if (!message.member.hasPermission("BAN_MEMBERS")) {
return message.channel.send("You don't have permission to use this command!");
}
let member = message.mentions.members.first();
member.ban()
message.channel.send(member.displayName + " has been kicked! :door:")
}
})```
how would I make node-got ignore HTTP errors?
How do I develop
No like I already have my bot how do I put it on the site and get the bot developer role
con.query(`SELECT * FROM economy WHERE id = ${message.author.id}`, function (err, result, fields) {
if (err) throw err;
console.log(result);
});
output :
bash[ RowDataPacket { id: '545490362568015873', coins: '1000' } ]
How i can the coins
get thw coins
@fiery crest nope
uh yes
it says undefiened
no clue then
. . .
hallp
i installed discord.py
im trying to make a simple test command
using the readthedocs.io page
i was able to make this for my bot
import discord
client = discord.Client()
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('kanatest'):
await message.channel.send('Hello!')
client.run('token')
i have that but what do i do with it
its correct and all as far as i know
but i dont know how to make it actually do the thing
im stuck at that bot-env place
where i cant do anything
so you know how you can make a bot listen for messages? is it possible to have it listen for a certain word no matter the capitalization?
of course
you just check whether the message content contains whatever you want
you'll have to either transform the string into all lowercase or use ignorecase comparison before checking the content though
the latter is faster
@earnest phoenix you can get it with result.coins
(keep in mind javascript encodes the query different and can fail if print it to console)
so i added python to the path
but like what do i do after that
the tutorial i got didnt tell me where to go
there is no commands.bot anywhere in what they told me
windows?
Bro how bot send message with animated emoji?
<a:some_emoji_name:some_emoji_id>
because discord made it so they can
what
Thx


anyways im stick at bot-env
idk what to do since they never told me what to do
it feels like they skipped two important steps
iima sleep anyway
let cpu = Math.round(process.cpuUsage().system)
can somebody help me why do i get that cpu usage?
bc in task-manager its like 4-7mb
iirc /1000
?
nvm was wrong
The process.cpuUsage() method returns the user and system CPU time usage of the current process, in an object with properties user and system, whose values are microsecond values (millionth of a second). These values measure time spent in user and system code respectively, and may end up being greater than actual elapsed time if multiple CPU cores are performing work for this process.
if (message.content === '!ping') {
// send back "Pong." to the channel the message was sent in
message.channel.send('Pong.');
}
this command keeps giving my node index.js errors
What errors?
/Users/can/JARbot/index.js:8
if (message.content === ' !ping') {
^
ReferenceError: message is not defined
at Object.<anonymous> (/Users/can/JARbot/index.js:8:2)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
Define it then
how:,
Hastebin your index file please
const Discord = require('discord.js');
const client = new Discord.Client();
client.once('ready', () => {
console.log('Ready!');
});
if (message.content === '!ping') {
message.channel.send('Pong.');
}
client.login
hi so
im a little bit confused about this....
i have this: js app.post('/save/:guildId', async (req, res) => { const guild = await guildModel.findOne({ id: req.params.guildId }); console.log(guild.prefix); await guild.updateOne({ prefix: 'a' }); console.log(guild.prefix); }); when i do aping nothing responds, when i do hiping it responds, and i log the prefix, it says a as the prefix
does anyone know why thats happening? im trying to make a save button for my dashboard btw
sir
Yes, you missed the message event
sı ı guess ı wıll ıngnore the lıstnıng for messages part
Are you updating your bot's prefix?
because thats what ı used
No, you are using the ready event
aıght
Read the guide and compare it to your code
ıl pass ıt
yep
thanks
would have wasted alot of tıme on that code
why would they put ıt there though
Their code is correct, yours isn't
both work
one returns the username the other one the usertag
(tag is Username#1234)
let arr = [1, 2, 3, 4, 5, 6, 7, 8]
function random_pokemon(arr) {
return arr[Math.floor(Math.random() * arr.length)];
}
if (random_pokemon(arr) == 1) {
message.channel.send(woolooEmbed)
} else if (random_pokemon(arr) == 2) {
message.channel.send(nickitEmbed)
} else if (random_pokemon(arr) == 3) {
message.channel.send(blipbugEmbed)
} else if (random_pokemon(arr) == 4) {
message.channel.send(rookideeEmbed)
} else if (random_pokemon(arr) == 5) {
message.channel.send(skwovetEmbed)
} else if (random_pokemon(arr) == 6) {
message.channel.send(caterpieEmbed)
} else if (random_pokemon(arr) == 7) {
message.channel.send(hoothootEmbed)
} else if (random_pokemon(arr) == 8) {
message.channel.send(grubbinEmbed)
}
}
}
}
})```
with that there is always a chance that nothing spawns
do you know the reason?
also do u know how i can make it a percentage instead?
so like a 10% chance a caterpie spawns and stuff
Actually something will always happen
When i use mongodb in nodejs, and have lets say something like db.user.find().sort({last_online_timestamp:-1}).limit(10).pretty();.
Will the query return all documents from a remote database first and do the sorting and limiting locally afterwards?
Next, copy your token from the client.login('your-token-goes-here') line and paste into the config.json file. Make sure to keep it between the double quotes.
wont work
So can i somehow get the behavior i have with simple sql queries, where i can compute all kinds of stuff on the database and transfer only the results?
hold a sec
when ıt says make sure to keep ıt ın double quotes
ıt means thıs rıght
" "
im not sure how u expect anyone to help u
all u've said is the thing from the d.js guide, and the token doesn't work and ur using the double quotes
ıt ınvolves my token so ım tryıng to fınd a way
tells me to copy and paste my token to confıg.json file
maybe just remove the token..?
with double quotes
you're not helping urself or me fix ur issue
then askıng for the code wont work
and replace it with something
ım tryıng to add the token to confıg.json fıle
ok, how do u expect me to help u when u've only told me that the token doesn't work, and ur using double quotes and u cant send ur code because then it won't work,
so ı can simply do client.login(config.token) to login
asks me to copy my token from ındex.js
move ıt to confıg.json
wıth double quotes
obviously using a json file is too advanced for u, just do client.login('token')
doubt that
doubt what?
smh
to use Now you can simply do client.login(config.token) to login?
ın the json file dont thınk so
What does your config.json file look like (remove the token)
smhsmhsmh
{
"prefix": "+",
"token": ""
}
how do i get the most recently called pokemon ID (the number from the array)(log it to a DB)
then when the person writes .catch, the pokemon name that was most recently called is logged into the mons.json
Hold on, can I ask something, does it work?
(not to you @long yew)
how do i get the most recently called pokemon ID (the number from the array)(log it to a DB)
then when the person writes .catch, the pokemon name that was most recently called is logged into the mons.json
what db do you use
does anyone know if i can limit an endpoint to one user without auth?
session
session?
Assign a user a token with cookies, and check if they have that token
oh ok
so can anyone help me?
Can you explain more
yeah
Ok
Yes
const DB = require('./client/db.js')
const express = require('express')
const app = express()
const tokens = new DB('tokens')
const ids = new DB('ids')
app.set('views', __dirname + '/views');
require("./client/client.js")(client)
const Guilds = client.db.Guilds
app.set('view engine', 'ejs');
const clientfunc = require('./client/client.js')
var cookieParser = require('cookie-parser');
app.use(cookieParser());```i do this
oki, thanks :)
yeah, it looks pretty simple
So you can set it for how long you want the user to be rate limited
e.g.
res.cookie('cookie_name', cookie_value /*Can be an object to contain multiple values*/, { maxAge: 'time in millesconds' /* Has to be a number not a string*/ })```
tried everythıng wont work
{
"prefix": "+",
"token": "my token"
}
"my token"
says to paste my token from maın ındex fıle to json wıth double quotes nothıng happens
not literally "my token"
how did you request your config in your main file?
what do you mean:
i'm $5
Deal
you can ask your question here lol
how did you tell your code to read your config file?
im a little confused about thism
app.post('/save/:guildId', async (req, res) => {
const guild = await guildModel.findOne({ id: req.params.guildId });
console.log(guild.prefix);
await guild.updateOne({
prefix: 'a'
});
console.log(guild.prefix);
});``` when i do `aping` nothing responds, but when i do `hiping` my bot responds, it logs the prefix as `a`
const config = require('./config.json');
Why do you need to ask in DMs Doggo?
does anyone know why?
what did you have in your client.login() line?
if you're doing something dumb, yes they will and you have no rights to complain because you're doing something dumb 
my token
I am purchasing a VPS
But I have no idea how VPS works
Can anyone help me pls 😥
lıke lıterally my token
write down there config.token
not "my token"
then it will load it from the config file
a vps is just a vm running on a physical server, it virtually doesn't differ from your pc
VPS stands for Virtual Private Server, it is used to run server based items like apache2 for websites etc
how do i get the most recently called pokemon ID (the number from the array)(log it to a DB)
then when the person writes .catch, the pokemon name that was most recently called is logged into the mons.json. if anyone knows please reply or dm me
You would need to SSH into it
@delicate shore i can help you
a vps is just a vm running on a physical server, it virtually doesn't differ from your pc
@earnest phoenix
How can I host bot on that
so clıent logın confıg.token?
ssh[name]@[IP]
client.login(config.token)
yes
I use Filezilla to transfer files
let me rey
i guess he is a linux newbie
I use Windows
how do i get the most recently called pokemon ID (the number from the array)(log it to a DB)
then when the person writes .catch, the pokemon name that was most recently called is logged into the mons.json. if anyone knows please reply or dm me
@long yew
Oh
I never learnt to use Linux
linux is usually half the price
We can assist
So I need to download Linux in my pc
no
no
atill nothing happens
By removing all the files of windows ?
The VPS will have Linux installed
you need a SSH Client like Putty
or Bash
Ok
json fıle shows error when ı moe my token there
it's a server
a VPS is a server hosted by a company
@dire stag more infos?
next thing you'll know, boom downloaded more ram
I started download putty now ?
const Discord = require('discord.js');
const config = require('./config.json');
const client = new Discord.Client();
client.once('ready', () => {
console.log('Ready!');
});
client.login(my token);
client.login(config.token)
putty is an ssh client yeah
why 2x login=
Technically you could use cmd prompt also to ssh into it
what ım tryın to do
This is for me ?
that'll help you log into your vps and generate your ssh keys
Ok
you just saıd
only 1 login line
Thats the Link for putty
ok now ı wıll try to move my token to the json fıle
so ı can use Now you can simply do client.login(config.token) to login
yes
I will come after few hours
wıth double quotes
like on the website you sended the link in
When i use mongodb in nodejs, and have lets say something like db.user.find().sort({last_online_timestamp:-1}).limit(10).pretty();
Will the query return all documents from a remote database first and do the sorting and limiting locally afterwards?
Can i somehow get the behavior i have with sql queries, where i can compute all kinds of stuff (aggregations,joins,orders,etc.) on the database and transfer only the results?
{
"prefix": "!",
"token": "your-token-goes-here"
}
``` if this is your Json
I tried other way to turn my bot on is worked but need set inf/24/7
it should work
yes ıt ıs
how do i edit a msg in eris?
It's buggy
then just make sure the path in your Main file for your config is correct then it should work
A lot of data has been wasted
const Discord = require('discord.js');
const config = require('./config.json');
const client = new Discord.Client();
client.once('ready', () => {
console.log('Ready!');
});
client.login(config.token)
thats my maın ındex.fıle
if the path for your config is correct it should work
that ıs the path
start and see what happens
config.json is showing an error
what is the error
can you make a screenshot?
I thought it was coma symbol
ok
@honest perch <message>.edit()
I think should to have copy important require
When i use mongodb in nodejs, and have lets say something like
db.user.find().sort({last_online_timestamp:-1}).limit(10).pretty();Will the query return all documents from a remote database first and do the sorting and limiting locally afterwards?
Can i somehow get the behavior i have with sql queries, where i can compute all kinds of stuff (aggregations,joins,orders,etc.) on the database and transfer only the results?
@viral spade what module are you using? That query looks like mongo shell queries instead of mongo nodejs driver or mongoose.
But for example <Model>.find().sort().limit().exec() on mongoose will perform all those operations on the database
where is the error in the json?
Token need code of your d.bot
did you got the prefix and the token in there?
yessır
did you got a , after the prefix?
Can you show us what the error is please
i guess he dont want to show the json bcs of the token
the error ıs my token
woow
how about you just show the error
this is probably the error
Only effect 1 each
It just like been a mechanic
if you have only ```
{
"prefix": "!",
"token": "your-token-goes-here"
}
lets ee
help me
no extra line or word
O..now i remember
what is the result without coins?
wait
what does ıt meant that ı can use clıent.logın(confıg.token)
this
you dont have the token in a file you could accidentaly upload
@earnest phoenix try result[0].coins
its already fixed
How can i reboot all shards with eval?
if something isn't defined, check the base object first and go from there
Anyone?
im not large enought to get into sharding
Using pc is slower than i think
@earnest phoenix what library
djs
client.destroy
d.js
I don't mean this.
does destroy restarts the client? i thought you need to login again
nvm
It's hard to complete without watch yt video
it just same if relogin
function lol
@viral spade what module are you using? That query looks like mongo shell ..
@bitter sundial
Yes i have not implemented it yet but ofc i intend to use it via the nodejs driver.
So when using <Model>.find().sort().limit().exec(), no data is transmitted until the exec has been executed?
im eating rn lol, im trying to type less
Lol
Can somebody help me get all servers my bot's in member count?
This is the code that i written, but doesn't work:
client.guilds.members.cache.size
It because the symbol missing..isn't
^
no need to map, you can reduce directly and essentially double the performance lul
had to map it first since reduce itself returned NaN
im a bit confused and stuck here, js app.post('/save/:guildId', async (req, res) => { const guild = await guildModel.findOne({ id: req.params.guildId }); console.log(guild.prefix); await guild.updateOne({ prefix: 'a' }); console.log(guild.prefix); });
when i do aping nothing responds.. and it logs a as the prefix
i do hiping and it responds.
Tim would you mind checking https://discordapp.com/channels/264445053596991498/272764566411149314/726396917231255572 too pls? 🙂
does anyone know why thats happening? im a bit confused
@digital ibex you need to supply a key for the query
wel, very confused
superbrain, wym?
1sec
i intend to use it via the nodejs driver.
My example was mongoose but similiar exists in the nodejs driver
So when using
<Model>.find().sort().limit().exec(), no data is transmitted until the exec has been executed?
@viral spade correct
depends on your library
Oh uh..i am lazy againist book
@viral spade i have 0 experience with mongo, but both mongo and sql should do that. all dbs should run queries inside the db and transmit only the results
thats a basic design for databases anyway
guild.updateOne({message.guild.id, {prefix: a}})
``` this will update the prefix in the given guild
its just the style of wrting with the dots in between always suggests to me that the first thing is resolved before the next gets executed
(if your model has a guild field)
I have mid low experience..so i try harder to get smarter
u can do it multiple ways, and im not using a discord api library
Same
its just a example
and i dont know how your model look. but if you want to have a per-server config you need to supply the index of the document you want to edit
how do i get the most recently called pokemon ID (the number from the array)(log it to a DB)
then when the person writes .catch, the pokemon name that was most recently called is logged into the mons.json?
that is my code
YIKES
bind the ID to the one that spawns and write it with the .catch command
how?
superbrain..
theres multiple ways of doing it, thats not the only way, and in the bot itself, thats the way i do it normally
cause i wanna log the id of the latest one that has spawned
it works perfectly fine for me
then be able to .catch
Okey follow up question. I am thinking about migrating my statistics bot from mysql to a sharded mongodb.
- For calculating stats i have crazy long queries, doing joins over all statistics tables, group and sum up each channels entries for a specific user etc. Will this be "easily" doable also in the mongodb setting (in one query, without getting part results)?
- Currently i have usual split relational tables as such "guild, guildmember, guildrole, textmessages, voiceminutes, ..". Should i transfer this style to make a collection for each table, or should i make 1 guild collection that holds all the other tables as fields?
Are there any other special caveats i need to keep in mind when changing from mysql to mongo?
i recently switched from mysql to mongo. for now i have a single collection for the guild settings. and a additional one for userdata
no
uh damn
maybe with the SDK
how do i set up intents?
do i need to have verified my bot before i can do that?
because i keep getting
Error [DISALLOWED_INTENTS]: Privileged intent provided is not enabled or whitelisted.
whenever i try to launch my bot
why do you need that
i did that a few minutes ago and it didnt do anything
I’m just curious why you’d need it
discord changes some stuff on the API to get better data protection
and did you remember to save the changes
to get in future access to it you need to be Verified if you have more than 100 guilds and enable it in the web panel
yep
personally, i just want to avoid dealing with anything i dont need to
my bot doesnt need to know presences or any of that stuff
and i dont want to deal with d.js caching it
then you probably need to switch to a other language
nah i mean for specifically presences, i dont want to cache them
con.query(`SELECT * FROM economy WHERE id = ${message.author.id}`, function (err, result, fields) {
if (err) throw err;
if (!result[0]) {
con.query(newuser, function (err, result, fields) {
return message.channel.send("You current credit is " + result[0].coins)
});
}
message.channel.send("You current credit is " + result[0].coins);
});
Help how i can fix
this
just dont deal with the new intent stuff. if you just have 1 or 2 commands that need them its better to just ignore them
@earnest phoenix what is broken?
{ Error: Cannot enqueue Handshake after already enqueuing a Handshake.
handshake in a handshake
bcs you have a query in a query
dont query in a query
then my code wont work
cuz i wanted to check does user is in the database
if not
i will create a new data for him
then call a function for the other query
nvm im dumb lmao i was enabling intents on my actual bot but trying to use them on my test bot

try it
ok
i usually have the mysql querys in a function and just call them in the code. so i can do ```javascript
const data = await getData(message.author.id)
if(!data){await createUser(message.author.id)
does anyone know why my prefix isn't updating?
my code: js app.post('/save/:guildId', async (req, res) => { const guild = await guildModel.findOne({ id: req.params.guildId }); console.log(guild.prefix); await guild.updateOne({ prefix: 'a' }); console.log(guild.prefix); }); ?
i had issues with a wrong field type
it says the prefix is a, on the second log, but its actually hi
this wont let it update it in the DB
me?
yes
why won't it update?
i dont think you use something else as fieldtype for your prefix as a string right?
wym by fieldtype?
when you create the model you define what type the field has.
string
like prefix: String
my guess is it cant find a document to update. but you said you use a different method
where is the discord development docs
wym
it can find the document, i log guild and it logs the guild object
the guild object in my db*
can you check on your DB server that it updates? (logging in with something like Compass)
it doesn't
its possible that there is some wired caching behavior that loggs the correct prefix but doesnt update it
i still think you need to define a index to the update query. im sure that prefix is not your index
what is wrong?
function getCoins(message) {
con.query(`SELECT * FROM economy WHERE id = ${message.author.id}`, async function (err, result) {
if (err) throw err;
const embed = new RichEmbed()
.setColor("RANDOM")
.setTitle(`${message.author.username}'s balance`)
.addField("**Money:**", result[0].coins)
return message.channel.send(embed);
});
}
function newUser(message) {
const newuserAdd = `INSERT INTO economy (id, coins) VALUES (${message.author.id}, 0);`
con.query(newuserAdd, async function (err, result) {
if (err) throw err;
const embed = new RichEmbed()
.setColor("RANDOM")
.setTitle(`${message.author.username}'s balance`)
.addField("**Money:**", result[0].coins)
return message.channel.send(embed);
});
}
===============================================================
try{
var coins = await getCoins(message);
if(!coins) coins = await newUser(message);
}catch(e) {
message.channel.send("Oops, there is a error !")
return console.log(e)
}
Damm it, it says handshake in handshake
sad
can anyone help me?
@long yew npm install fixed-width-string
@lusty quest im confused, wym?
ok ty
im wasn't talking to u
one sec
or anything related to his issue
@earnest phoenix your code will not work like expected
@digital ibex iirc query is Model.updateOne(key, {fields})
well my knowledge with mongo is not the best rn since i just started using it
@long yew show code
mongo is good
@earnest phoenix what part?

