#development
1 messages · Page 960 of 1
n-GnxFS1yZEZ2vSOaqXDkk-ppvp8MTU5MTQ2MzY1MkAxNTkxMzc3MjUy
@next escarp that's no token dude, discord tokens have 3 sections
to prove a "point"
that's literally something in youtube's html
but either way you wouldn't put my "token" publicly unless you either wanted people to use it or you wanted to scare me bruh
why doesn't it work again
don't worry zen, he just mistakenly minimodded u
yeah
BUT, if you really want to scrap the site, you'll need some regex
i dont know youtubes api and i already coded it this way and i am too lazy to change it
idk javascript well but you could have just defined the embed weirdly
oh i know whats wrong
try return message.channel.send(serverembed);
ok
const Embed = new Discord.MessageEmbed()
// ADD AN INDENT
.blahblah() something balh blah javascript
then do message.channel.send
what
zen r u ok
no lol
but i know he doesnt use a { or } anywhere so he would probably need to indent it to show that its part of the last line
doenst work
or atleast i think thats how code works
what
nope
who knows?
you can write javascript entirely in one line
only python uses indentation for code syntax afaik
all i know is the official js guide shows an indent so
oh
it says channed.send
im too stupid to help imma be on my way
hey! i'm trying to use google's translation API, but there is a required field that I don't understand... it's the parent field. i've alredy tried projects/:my project id but it doesn't work.
here is what they say about it :
hmm yeah that should be correct. what do you get as response?
I'd not recommend using google translation api
well i'm really sorry, it looks like the error was cached or smth x) it works now
@lyric mountain why?
the quota will stop your bot from making further requests
gtanslate api's free plan has a VERY low quota
api key rotation 
I like the way you think boi
but then you'll probably get ip/account banned if you piss them off
that's not enough context
I can't tell anything from that snippet
@lyric mountain do you have any recommendation to replace gtranslate?
I'd recommend yandex api, their translator is quite good for a free service
I use it for my bot
ok, ill try it, thanks

what the
my guy
wtf
you cant kick ppl
and you cant kick ppl over any bot here anyways
i dont care you still pinged me a bunchof times

because it makes a (DUH DO) sound
its annoying
Which is the best free discord bot hosting service? I want to host it on a free one before it will be finished, then i'll buy a vps 🙂
depends
how do i make a bot ping cmd that shows the ping
In your opinion, what whould you choose?
?
Ok, thank you
?
In your opinion, what whould you choose?
@earnest phoenix if it's just for testing purposes: glitch, heroku or google cloud will do
yeah, each one have its drawbacks
but as I said, if it's just for testing then it's ok
you don't need THAT performance nor reliability for that
i'll give it a look later, guess I'll migrate my api to it
anyone got any idea why my discord oauth2 loads for around 15 minutes when using a different mongoose model? the models are exactly the same, the only thing i change for me to make it load for ages, is change the path of the model
and when it eventually does load, i get an error: InternalOAuthError: Failed to fetch user's guilds
I was in the middle of making a set log command and I had the actual set log part but set.serverlogchannel is undefined, What would i put instead or how do I define it (I'm still learning js)
can anyone help me about python?
my level system levels bots
but i dont want it to level bots
i tried already 20 minutes to solve that problem
hmm
note that idk very much about python
just check if the user is a bot, if it is then break the code
ah ok
first line in the onMessage event
user is not definied
async def on_message(self, message):
not a copypaste-ready code
get the author from the message
it should have a bot attribute
A main downside from glitch is that you might need to replace your token almost every time, even with a watcher script.
wich sucks.
im trying to use snekfetch to use api but the code will not run
it's indicating no sign of error, just not running
like it just BREAKS, no code after it is getting ran, and the program doesn't stop
here's the code
const {get} = require("snekfetch");
const Discord = require("discord.js");
exports.run = (client, message, args) => {
let animal = args[0]
console.log(animal)
if(animal === 'dog'){
console.log(animal)
get('https://some-random-api.ml/facts/dog').then(res => { // BREAKS HERE
console.log('got')
var randomColor = Math.floor(Math.random()*16777215).toString(16); // randomizes colour again
console.log('randomized')
const dogEmbed = new Discord.MessageEmbed()//creates embed
.setAuthor('Dog Module')
.setFooter('Dog provided by animal-bot (built and hosted by the Animal Bot team)') //sets footer to this text
.setTitle("🐕Here's your random dog🐕") //the main message
.setColor('#' + randomColor) // sets the colour to the random colour
.setDescription(res.body.fact)
console.log('embed done')
return message.channel.send(dogEmbed); //sends the embed
console.log('sent')
});
}}```
Snekfetch is deprecated by the way, you should use https://npmjs.com/node-fetch
i will try that
i've asked this question loads, can someone please answer!
I was in the middle of making a set log command and I had the actual set log part but set.serverlogchannel is undefined, What would i put instead or how do I define it (I'm still learning js)
you'd need to make it a constant or smthing
const channel = message.channel.id```
something similar to this
how is that gonna set my channel to set the log channel
wait so underneath the " set.serverlogchannel" i put "const channel = message.channel.id"
idk actually
wait let me customise the const
const serverlogchannel = message.channel.id
``` and that'd go under the command listener
right so ```client.on("message", (message) => {
let args = message.content.substring(prefix.length).split(" ");
const serverlogchannel = message.channel.id
switch (args[0]) {
case "setlogchannel":```
that sets the log channel to the channel the message was sent from
Hey guys, how can i add link to the embed title just like this picture using js?
ok tysm!
.setURL('url here') it might be this @granite perch
.setURL('url here')it might be this @granite perch
@misty sigil it works thank you
yes i'm using it on my current project
what for?
for fetching data from a graphql api
its a returns promise
what is the problem ?
resolve it
yes you have to resolve the promise
ah, thats fine
something like this
const args = message.content.substring(prefix.length).split(" ");```
anyone know what that means
yea
im attempting to change the prefix from / to the bot's name and its working but they both register as prefix's and i want it to be just the 1
now that, i have no idea
but what does that const up there
it tells you what the arguments are
whats prefix.length
hm
ok ill keep looking
everytime i do /help and glitch help
both times
it works
for either prefix
and i cant figure out why
ive went through the main files and made sure that where it said / i replaced it with glitch
<@&304313580025544704> Can someone change my name to Beaster888 cause Sklitl was my past name and it stayed when I got my bot approved.
-atmods
Please do not mention (ping) more than one or two moderators for help, unless there is an emergency.
Here are some examples of emergencies:
- Raids / Multiple members mass spamming.
- Severe disruption of Discord's ToS (NSFW content, etc)
- Anything that requires more than 2 moderators to handle.
i have this
userscore = client.getScore.get(user.id)
const args = message.content.slice(prefix.length).split(/ +/)
const detail = args.shift().toLowerCase()
if (detail[1] === 'test') {```
where its trying to get user arguments but I dont know why it only shows the command
its supposed to be ran as ?shop buy item
idk man
and I want to keep it one command
yeah
runCheck: function(guild) {
const currentMembersPeak = guilds[guild.id].members
const currentOnlinesPeak = guilds[guild.id].onlines
const currentMembers = guild.members.cache.filter(member => !member.user.bot)
const currentOnlines = currentMembers.filter(member => member.presence.status != "offline")```
im trying to figure that out
says on line 3
that
members is undefined
cant read property type of members undefined
and ive never had this issue in this file before
and ive never made changes to this file before
is there a way, in python, to turn an emoji in unicode to the discord string (so like 👍 -> thumbsup) and back?
i don't wanna manually make a dictionnary either
i have reasons, my text file converts the emojis into utf8 and then its a hellhole to get em out in a usable fashion, better to have a way to turn them into and back out of a string or sthg
i could use ascii character ids tho
ill try that
well the id thing worked so i guess im good
ill have to get custom emoji implementation now
but anyways thanks for trying :D
*for your time
lmao it was just a url map I've used in the past
you've been told so many times to learn python
so please, just learn it
ik u r, cuz idk python
Calmdown bro
I kinda know python
im learning python, starting to like it 
Python makes no sense to me lol
one of python's many ways of building strings
i think its when u r gonna have variables in the string, so like ```py
ctx.send('{member.created_at}') # will return {message.member.username}
ctx.send(f'{member.created_at}') # will return OfficallyLost
not wait
no
create_at is a time stamp no?
im dumb
Same
yeah. idk why i had created_at and username
@still merlin I have no idea what the code is, you censored too much
What's the error?
you didnt close the arrow function
nevermind i fixed it
Between before and now you close and reopen the back ticks
Was that the problem you fixed?
Oh I didn't even see that lmao
yeah i realised i forgot to add brackets to the end and a }
does anyone know how i request a oage and change the result to json like with a API?
[axios used in js]
I have a problem
With my bot
Im trying to make it play music
in a channel
but it joins
it shows that green circle
and you cant hear anything
code
Im trying to make it play music
@wet iron little bit generic but ok
message.react(':thinking:').then(console.log).catch(console.error);
quick question, how can I react on a specific message id?
🤔
like this
dont put it, just put the original emoji if you just use discord's emojis.
So as i have a bot made from discord.js... and saw that the discord.py can access to user's nitro info to show it on my userinfo command... Is it even possible to like use both the libraries... Like discord.js being the whole bot as main... But using discord.py at the other hand to check that info and use it on my userinfo command?
wym users nitro info?
like... If the user has the nitro badges and stuff
@earnest phoenix ? I want to react on an old message
I dont have a problem with the emoji
oh,sorry.
YOU CAN CHECK MEMBER.PREMIUMsINCE AND IF ITS NULL THEN THEY DON'T, OTHERWISE, THEY HAVE NITRO
uh
sorry
No not that
caps
kk
https://hastebin.com/doxuqufivi.js
On line 20: info is equal to
access_token: 'cv...',
expires_in: 604800,
refresh_token: '7k...',
scope: 'identify guilds',
token_type: 'Bearer'
}```
/users/@me/guilds is returning unauthorized for some reason
any idea why?
// in msg event
const active = new Map();
const options = { active: active };
await cmd.run(bot, msg, args, options);
// in play command
module.exports.run = async (bot, msg, args, ops) => {
const data = ops.active.get(msg.guild.id) || {};
// ..
ops.active.set(msg.guild.id, data);
Problem is is that there is never data
where do I need to use msg.client?
its not related to your issue its just an enhancement
hmm, I tried this, but it didnt work
message.channel.fetchMessage("570646739145457685").then(message.react(emotes[0]).then(console.log))```
error:
```console
TypeError: message.channel.fetchMessage is not a function```

message.channel.messages.fetch()
thanks
hmm, still not working
message.channel.messages.fetch("570646739145457685").then(message.react(emotes[0]).then(console.log))
any error?
nope
@midnight blaze here
message.channel.messages.fetch("570646739145457685").then(message => message.react(emotes[0])).then(mr => console.log(mr))
thanksxD
@earnest phoenix can't find anything about it, unsure. sorry about that
It's ok
i'd use async/await instead of callbacks pangloss
I mean it's the same thing but sometimes .then() doesn't work on some functions
So yea some functions doesn't work with .then(), use async/await
Ok, so I'm using json to keep my ticket bot's data.
JSON code:
{"ticket-counter": 0, "valid-roles": [], "pinged-roles": [], "ticket-channel-ids": [], "verified-roles": []}
Even if the bot is on 6 servers, and there is 1 ticket on one server, for the other server it'll be ticket-2.
How would I make it so that every server it joins, it adds the server id and resets it to 0 for that server?
i mean, idk if using json is a good idea to use for heavy data on a bot that can grow. if you want to use json structures, then i suggest looking into using quick.db
json is more for lightweight data, such as holding credentials, or data, that hardly ever needs to change, and is small. SQLite and MySQL is better for heavy data, such as database data, or data that changes a lot, or needs to handle a lot of data.
hey!
I'm working on a discord bot
using an attachment system
what is a proxy url? I can't find anything about it on google
@earnest phoenix do you know anything about this, you were helping some people
rip, I just wanted to ask him as well
?
~~ look at my status please ~~
@tropic moss proxy url is a url that if the image doesn't have an actual image extension... It will show the image anyway
Proxy url is useless with text file extensions
same way you would with any other file ig
@earnest phoenix can I ask you again something about the command you have written?
Yea
@earnest phoenix the command you have written, I have wainted to make a for loop, so each of the emojis get reacted
something like this
for(i=0;i<5;i++){p++;message.channel.messages.fetch("718591041149861888").then(message => message.react(emotes[p])).then(mr => console.log(mr))}
but only 1 emoji reacts
ty
Can't you just do a forEach() ?
where should I add the forEach() function? :>
Wait forEach() would not work but i have no idea how to make that thing work
Lol
just like
message.channel.messages.fetch("718591041149861888").then(async(e) => {
await e.react('emote');
await e.react('emote 2');
});```
i believe that should work
when looping with promises always use async/await syntax unless you purposefully want to execute them concurrently and dont care about their order
How do you get a guild icon with oauth2 icon property?
icon: 'fab0d3bd981d3b6a00da3a9ca2dc044b',```
I forget the url
@mystic violet should be something like cdn.discordapp.com/icons/GUILDID/iconurl.extension
i am making discord js bot and certain commands get delayed until next command is run. I don't understand why or how. ping me
idk either mate
alright so basically i want my prefix to be * and i dont want it to accidentally format the text, so how do i force it to not format the text, do i just add a backslash before it?
yeah lol
i did try and so far its working just fine
thanks mihzo
i got no clue ben, i'd love to help but i got no idea
ive never seen code that looks like that before
Raspian is linux isnt it?
just download it like you would on any other linux distro
Raspbian is Linux
It is a Debian based Distro if I remember correctly
RUN AS ROOT
curl -sL https://deb.nodesource.com/setup_14.x | bash -
sudo apt-get install -y nodejs
@earnest phoenix
@digital ibex thanks for your help
https://cdn.discordapp.com/attachments/468249189332287498/718605217347928064/Unbenannt.png
this what I use now, I dont need to type each emote
thats kinda going the long way lul
np
how can I determine if the bot can send a DM to an user?
hi
@tired nimbus you can just try to send the message and if it fails (for ex: theres a promise rejection) then handle it accordingly
you dont HAVE to check if your bot is able to dm a user before trying it, as long as you have corresponding error-handling
I already tried and catched and it still retruns an error
.catch()?
what exactly are you trying and catching ?
the send
use send(...).catch(err => {})
I did
wrap it in try {} catch(e) {} if that doesnt work?
I did it still returns an error
if you're gonna use try catch you might as well use async / await
you have another error then...
@tired nimbus what exactly is the error?
lmao
DiscordAPIError: Cannot send messages to this user
I think its a different error
or somewhere else
let user = await Bot.users.fetch(vote.user);
if (user) try {
let dms = await user.createDM();
return await dms.send(`too long`);
} catch (e) {
return;
}
this is how i sent users
it doesnt produce an error when i block the bot
this was pulled from my top.gg webhook part of my bot, but im sure w some modification you could make use of it
my lavalink node is giving me this.. any way I can resolve this? js [20:34:31] [lava-daemon-pool-playback-1-thread-1/ERROR] [LocalAudioTrackExecutor]: Error in playback of r7Ve8ExE8YY
Can you not disable certain events anymore in v12?
my bot sends 3 embeds for every command, no idea why lol, someone help me figure it out?
idk canarado
im pretty sure u can
Can you not disable certain events anymore in v12?
@dusky marsh it is removed in v12 iirc
regenerate token
hi
So
What is bottlenecking your bot?
Like, how have you noticed that the vps can't handle it anymore?
well it used to run fine but now its in a lot of servers it cant anymore
like i start it up and it flickers on and offline
doesnt even finish its on_ready event
no no errors show up
Use esc to clear message notifications
Still
You shouldn't be having issue with only 100 servers
@earnest phoenix shiro
Maybe it's some issue with your code
When did that start to happen?
i mean maybe but all my other server bots run fine, and the bot in question runs fine from my home computa
Do you use in-memory data storage?
that could explain it but i have no idea what could cause that, other than some strange memory leak
which i dont think could be possible
ok im gonna try running like a hello world bot on the token and see what happens
Storing lots of data inside variables is a probable memory issue
It can drastically increase your bot's memory footprint
I'd check this kind of thing first, since moving to another vps will just act as a placebo to the real issue
yeah
ok ok check this out
this is what i thought would happen
this is the code i wrote
like as barebones as possible
it cannot run this on that token
You might have hit an api rate limit. It's rare, but it occurred to me once. Turn the bot of for 24h and look if it works again.
(Workaround to test if this it the problem: register a new bot at discord.com and put that token in your bots' code.
@shrewd prairie
registered new bot, yeah that runs fine on that token
im not really convinced thats the issue, the bots been down for a while due to me not wanting to deal with it
Then it is you bot that is being rate limited.
If you are convinced it is not a rate limit, I suggests you fill out a suport form on discord.com to see what's going on.
What library do you use? discord.py?
Ok, recap.
It doesn't work on vps with token 1, but it does work with token 2.
On pc it works with both.
Is that correct?
yes
Is the latest version of python installed on the vps?
And did you try without using async functions yet?
async doesn't always throw an error
no, same version as windows pc (3.6.8)
no, i dont know how
Just remove every async and await should do that
i may have just figured out the issue..
i physically do not have that much memory
i have 500mb
checked how much i was using
a lot
its not that i have leaks anywhere i just. do not have that much memory to run a lot of things
You used more thatn 500mb for that hello world thing?
no i run other bots on it
Oh, I see
but apparently the hello world bot tipped it over
ah gee
guess ill optimize my other bots lol
Memory leaks are never a good thing. Even with little usage/users, it will crash over time
Np :)
oof
can someone help me with creating a backdoor to my bot
i need admin only commands to work for me even if im not admin
someone please
that doesnt look like bot development.
-botcommands
Hey! Bots aren't given permissions to send responses in this channel. Please use #commands or #265156322012561408 to run commands. In addition, bots with commonly used prefixes cannot read or send messages in any channel. This is done to prevent spam and bot abuse.
anything wrong with ending something with ```js
return await promise()
// instead of
return promise()
return await returns the resolve value of the promise if there is one, return just returns the promise
are you asking what Promise { pending } means?
no what the entire error means
previously it was an if err throw err
but it still refers to that line
i just dont understand what it means
How do you see the amount of members online
Ex
Users Idle : 3000
Users DND : 5000
Users Offline : 50000
@proven lantern
um
idk
my friend did this
its a part of his sql database
which i know nothing of
learn d.js before making a bot and taking people’s codes 🙈
is there a const con = or let con = somewhere
I wanna use my db a little more
by adding a toggle setting to some commands and banning users from certain commands in server
I actually own 2 db’s
that's crazy
crazy
but possible
DEEP RESEARCH TIME
so like I’d make it store a list of banned user from x server
@rivex
How do u make is so if theres a error it shows it in chat
I don't think you can get the DM channel
For bots, this is no longer a supported method of getting recent DMs, and will return an empty array.
If you are trying to create the DM, then the recipient_id should be in your request body
not a query string
Why do you need to do that?
recipient_id shouldn't go in headers, but in body, aslo you need to provide an Authorization header
Oh
Yeah there is broadcastEval
I can't do manager.broadcastEval with Kurasuta
@wide ridge yeah
See that's what sucks about discord.js, you don't have the object - you cannot do anything else, even if you have all the data you need (ids)
ye I need the ShardClientUtil
so with clustering, I'm not sure how I would get that set up properly
I tried manager.client.shard.broadcastEval
You don't need to do that
but manager doesn't have that property
You can just do client.shard
.broadcastEval
Or bot
Or whatever your client object is
That should work
And you also have client.shard.send()
it's in a different scope tho, I'm trying to do it in a different file
my index.js has the shardingmanager
and my shard.js has the client objects basically
yeah
It's the same as djs sharder in this case
I'll try it out and see how it goes
i want it to only send 1 dm, so I'll probably need to check if isMaster right?
client.shard.broadcastEval("client.user.cache.get('userid').send('message')")
Since only one shard will have that user
wait wait wait
I didnt, the only thing i did was host it, when i do it local it works
Kinda weird
Ill take a look to be sure tho
Are you hosting on heruko?
yee
same happened to me, but instead all the text just disappeared
I fixed it by not hosting the bot on heruko
😂
Ill just look into it, if i cant find a solution then no emojis
Cant be bothered
again
The database name cannot contain a .
The error says it all
port 3306 is not open on 127.0.0.1
you are trying to connect to something that doesnt exist
repl kek
I have this in my code (html website)
app.get('/', function(request, response) {
response.sendFile(__dirname + '/views/index.html');
});
and i want to add another page, so when i press a button i get there
i added a botinfo.html file, but i cannot add response.sendFile() to it
so u want it to be like ursite.com/botinfo
yeah
you'd use response.render('botinfo', 'path to botinfo.html')
for ejs anyways
u can try it, might work
TypeError: Cannot create property '_locals' on string '/app/views/botinfo.html'
app.get('/', function(request, response) {
response.sendFile(__dirname + '/views/index.html');
response.render('botinfo', __dirname + '/views/botinfo.html')
});```
which one?
it will if i remove the other part yes
but i want them to all work together
and i cant add another app.get because it wont work
then use seperate files, and in that seperate files, use router instead of app and then you can do it like that to make the url hi.com/index/botinfo/ or something
you probably can use it in the same file, but with router. unsure
router will be ```js
const router = require('express').Router();
so confused
why cant i just use
response.sendFile(__dirname + '/views/index.html');
response.sendFile(__dirname + '/views/botinfo.html');
});```
this is in my main file
server.js
unsure tbh, but ur code will be something along the lines ofjs const express = require('express'); const app = express(); const router = require('express').Router(); app.get('/', (req, res) => { // do whatever u need to do here router.get('/something', () => { // do whatever u need to do here }); }); im not sure tho as i use separate files cuz i think its easier than doing ^^
you can, if that doesn't work , do ```js
const express = require('express');
const app = express();
app.get('/dashboard', (req, res) => {
// do whatever u need to do here
});
app.get('/dashboard/settings', (req, res) => {
// do whatever u need to do here
});
app.get('/dashboard/account', (req, res) => {
// do whatever u need to do here
});
that one will obviously work, but its not the cleanest way to do it
app.get('/', function(request, response) {
const router = require('express').Router();
response.sendFile(__dirname + '/views/index.html');
router.get('/botinfo.html', () => {
})
});```
what about router.get
what do i do there
i'd put the const router = ... outside of {} and u do whatever u'd do with app.get
but im asking what about the router.get
what does it even do
Cannot GET /app/views/botinfo.html
its middleware, it refers to how ur enpoints respond to requests
Error: Can't set headers after they are sent.
yeah, i had a feeling it would error, try using https://discordapp.com/channels/264445053596991498/272764566411149314/718790931595264010
app.get('/', function(request, response) {
response.sendFile(__dirname + '/views/index.html');
response.sendFile(__dirname + '/views/botinfo.html');
});```
this is supposed to work, but i get CANNOT GET error
thats cuz the file ur trying to access doesn't exist or the path is incorrect
u need to make it
im not too sure, but ^^ for context and idk if it would help
im kinda confused why its not working tbh
have u saved it?
yes
no
does it error?
whatever you use .get with is undefined
i have really outstanding problem
am using enmap for database
every time i write a new value it takes about 3 minutes to write it globally
this is what i men
I use bal command and see my balance is 1000
i have a beg command. The beg command gives you +50
I use bal command , bal is still 1000
I wait for about 3 minutes
then when i try bal it works and shows 1050
but it doesnt update instantly
i have done expermint and i know the beg command writes the new value instantly
the problem is the bal command
Try switching dbs
have you tried mongo?
Maybe to something like mongo
aaaaa i jus switched from json to enmap lol
ill try mongo i guess
its not complicated is it?
Was there a reason why you chose a local database?
idk how to do databases
enmap is a thin wrapper on Sqlite isn't it?
No
i mean no
There are more robust in the sense that if your machine hosting the code goes wrong, your database could be too
Sqlite is perfect for things like Android apps and small things. In an Android app, you could use Sqlite as a SQL cache against network requests so your application can work offline.
You also need to take into account your disk speeds since they will always have a large factor on how well your database can react to immediate reads and writes. By far, you want an database on a SSD.
And if you can live with it being temporary to an extent, tmpfs.
Then you came to the right place
https://dontasktoask.com/ @true pawn
@willow marlin Are you sure the database is at fault?
@hasty sparrow My bot is stuck and if I create a new app, will I?
Yeah, that's a good suggestion, what exactly are you doing that causes writes to be that long?
I mean, you could try Redis instead, that's battle tested as all things go.
just reset the token
@honest perch I reset the token but does not log in
you have to login using the new token
How many rows do you have in your table(s), any indexes, using caching, etc.
with mongoose its pretty simple\
Time to learn the basics
This guy sounds like he should be using quick.db
I get an error: (node:1222) UnhandledPromiseRejectionWarning: Error: Something took too long to do.
you have probably been rate limited
Kudos for not using JSON as database
uh
@true pawn Screenshot the error
im just writing numbers
you have probably been rate limited
@honest perch what should I do ?
me ?
yes
evet
@willow marlin How many guilds is the bot in?
what happens when you run the command @true pawn
curl -I https://discordapp.com/api/v7/gateway
ok wait
@true pawn Türk müsün?
@earnest phoenix evet.
you have been ratelimited, above is the glitch thread for that
i also suggest that you dont use glitch for discord bots
Sa
As
i also suggest that you dont use glitch for discord bots
@honest perch what can i use?
I do not want to pay
Heroku has a free tier I think
then goodluck with getting ratelimited
oof
@willow marlin How many guilds is the bot in?
@hasty sparrow
76
there is no free good hosting
@true pawn someone said on glitch forum it mean ur host banned
@willow marlin Are you sure the database is at fault?
@hasty sparrow
What else could it be
@true pawn try google cloud 30 days trial maybe its can be helpfull
@true pawn someone said on glitch forum it mean ur host banned
@wild mist
I had that issue
a raspi isnt that expensive either
hmm
U have just have to remix to fix it
Raspberry PIs, do they still mess up SD cards due to writes? My SD card didn't last as long as I would like
My phone messes up my SD and I have to switch it once a month
That's extremely odd
as long as you dont buy an sd for $2 off of AliExpress you will be fine
thanks i took care of my problem
For that to happen, your phone or something must be writing gigabytes very frequently to occur.
U have just have to remix to fix it
@wild mist thanks bro
@willow marlin I'm curious to know how many rows your database table has
It's Sqlite, it has to have rows
If it's huge and hasn't got an index/bad index, then the updates will indeed be slow
In the database the name and Mony is stored
Every entry is a row
"Mony"?
Money
Okay, how many inserts or create new records do you think you're doing?
One
What.
What are you using as key for each user?
This sounds like a massive table lock then.
Lmao, DMed me as well
Lol same
Same.
@green kestrel Got @rose glen dming a bunch of people about missing perms
Do you know what your table schema looks like? You said and ID and money, so it is literally a table with 2 columns?
Right, so in order to actually answer our questions, Duke's included, we need to know what this table looks like.
I have no idea how to see the table
Otherwise we're just stabbing in the dark.
Is this virtual table?
523039234022440962 => name : 523039234022440962
Money : 69
That's what it looks like
Where are you hosting this bot?
Is there a database file anywhere?
Grab something like https://sqlitebrowser.org/ and open the .sqlite file
And are you able to copy the contents of where this db is hosting to your machine? I don't know if that's wise or not, copying a sqlite file while it's running.
Ahh
Is there a database file anywhere?
@hasty sparrow
No it's virtual database
Ahh
@hasty sparrow
Even on glitch and heroku it didn't work
If the data persists through restarts, then it has to be stored somewhere
But you don't know if it's starting from scratch right?
What do you mean by that
As in, when you kill and restart it, does the data that you saved in a previous session still exist?
Cool, so this means the data has to live somewhere since it lives outside restarts right?
Probably
But it seems you don't know where that is?
Ohh wait
I know
It shows up on glitch
Only glith
As a weird stream of unidentified emojis
It's not a readable text
Probably stream data then. I think we know what the problem is then.
Glitch is probably not a good place to save a lot of data, it has to go over some sort of network and some file system that you don't know about
Yep that's why I switched to replit
I don't know how old you are, but it's effectively similar to writing to a floppy disk; slow as all hell.
Oh ik
So I don't think sqlite is to blame here; provided that the file is on the same device that's running your code, it will be fine for most low-medium traffic.
But writes to some unknown file system, who knows at that point.
Stop using enmap and sqlite
Pretty much what Duke said
MariaDB/MySQL/PostgreSQL/MongoDB/anything
Some alternatives are MongoDB atlas, Heroku with SQL, Gigalixir
Depends on your data structure
If I want to store timestamps as well
I don't even think you have a proper hosting solution in place.
Probably better off using MongoDB Atlas since there's a free tier: https://developer.mongodb.com/quickstart/free-atlas-cluster
What does a free tier do
Use proper hosting, glitch and repl.it are both for prototyping, not long term hosting
Costs nothing, data limit 512MB.
Back to this again.
Not even a fiver a month?
Could you show the command code that updates the user's balance?
If that's the one that updates it, then yes
It's funny because the database works when I store timestamps for cooldown
Flyaway, do you want a $100, 60 day credit for digital ocean then?
How do I get
Helping millions of developers easily build, test, manage, and scale applications of any size – faster than ever before.
Do u wanna see my whole code
No shame here.
hastebin it
Oops was I meant to hastbin I thought you mean pastebin
@willow marlin This seems a lot like the issue you are encountering: https://enmap.evie.dev/usage/using-from-multiple-files#a-common-issue
Uh
Why are you creating a new client at the top of your command file?
Ah I think that's because
I wrote my enmap as bot.balance
And bot wasn't defined
define bot
Because "Bot" is not defined
variables are case sensitive
restart your app
Try again
Is "bot" defined in the command file?
its defined in index.js
Can you show the line which errored
You can't just use one file's variable in another file (without importing/requiring it, but that makes no sense in this case)
oh
Also if bot.ping will be undefined , u have to type bot.ws.ping
depends which version he's on
@willow marlin It's definitely not enmap fault, reads for one operation at at 0.384ms, while writes/updates are at most 1.2ms
Also, instead of this:
bot.cooldown.ensure(`${user}`, {
name: user,
beg: Date.now()
}); //check for time beg
var cooldown = bot.cooldown.get(user, "beg")
You can just do
const { beg } = coolDownTable.ensure(user, {
name: user,
beg: Date.now(),
})
Saves you one query
Also, your database looks like this.
uh ill show u
Well, at least has that structure anyways
hi, any good lib for discord bot
c# btw, i only know c# (and pascal)
i said c#, not javascript
Literally google
dsp
wut is .first() using for 🤔
to get the first of that object in a message i think
collection/map
:0
message.mentions,users.first()gets the mention
yes
any lib that i can use with mono
discord.js
bruh he c#
Why Mono. It has dotnet core support.
DSharpPlus or Discord.NET, no clue which one/if either supports Mono
@willow marlin This seems a lot like the issue you are encountering: https://enmap.evie.dev/usage/using-from-multiple-files#a-common-issue
@hasty sparrow
hold on i already do thhat
Incorrectly, yes
The shared variable method latches onto the bot initialized in your main file, whilst you add the balance to a new instance inside your command file
oh what am i
doing wron
oh
so when i call it in other files do i need to define it?
No, you access it through the bot instance
so
index.js
const Discord = require ('discord.js')
const bot = new Discord.Client();
const Enmap = require("enmap");
bot.balance = new Enmap({ name: "balance" });
balance.js:
const Discord = require ('discord.js')
//without defining it
bot.balance.get
Probably don't need to require discord.js in your balance command file, but yes, that would be the structure
but then it will say bot is undefined
Are you passing the message to the command method?
message.client is the bot
do i still have to define enmap
No, you already defined it once in your main file
kk
I have a good idea
huh i passed bot but still no define
oh i defined it before i defined obt
sorry
o lmao enmap is not defined
do i have to pass enmap as erll
The guide explains what you have to do and how to use it
I wanna create a bot-ban system that doesn’t allow users to use commands. it could be specific commands or it could be the whole bot. It’ll be server-wide so I can store data in a db which includes time remaining, and ban reason. I’ll use the DB to store USERID that do bad things and have em erased of the face of the planet
the only issue with that i s you have to convince developers to use your system
any idea why my embed creates a line with undefined? https://i.imgur.com/cokBx9Q.png
.setColor('#006c80')
.setTitle(`Vote Leaderboard`)
for (var i=0; i<chunked[n].length; i++) {
prevembed.addField(`User: ${chunked[n][i].username}`,`Votes: ${chunked[n][i].votes}`)
}
prevembed.setFooter(`Page ${n+1}/${chunked.length}`)
sendmessage.edit(prevembed)```
is the code for the embed
have u defined the variable n and chunked?
yes
its an array from a database with a few thousand returns. i chunk them into 10 datasets per chunk
Why are you fetching so many results when you only display 10 at a time?
its an interactive embed. with mutiple pages
so i can limit the results per page
but my issue is that i get on my first page always this undefined page
is it because n+1 / chunked.length at that point is a dodgy number
as in like 0 or 1
or nan
NaN
n is defined as 0 in the beginning
but since its an Array that starts at 0 but i want to be the first page to be 1 it sets n to 1 for the footer
also the footer is not in the for loop and appears only once
running this loop also gives the same result javascript for (var i=0; i<chunked[n].length; i++) { // embed.addField(`User: ${chunked[n][i].username}\n Votes: ${chunked[n][i].votes}`) embed.addField(`User: test\n Votes: test`) }
found the issue
What caused it?
the AddField is only 1 field and the undefined is the missing Field title
what did you want to do?
im trynig to follow tha
enmap is fine but you should not use it with more than 10 Guilds
whot

