#development
1 messages · Page 592 of 1
if you dont know how to make it
Learn
that's like saying i cant walk yet you've never tried
hello, someone can help me with a strange error in my code (of my bot) ???
someone know mega-dtbs?
I'm having some issues regarding sessions with SQLalchemy in my bot
i'm trying to fetch some data from my database using a model
user = model().get(user.id, ctx.guild.id)
balance = user.amount
model : https://hastebin.com/cuzajimuli.py
which gives the following traceback
Ignoring exception in command coins:
Traceback (most recent call last):
File "C:\Users\Jamy\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\ext\commands\core.py", line 64, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\Jamy\Desktop\python\KonekoBot\src\cogs\economy\currency.py", line 31, in coins
embed = discord.Embed(title=f'`{Name.nick_parser(user)}` has {balance.amount} :neko:',
File "C:\Users\Jamy\AppData\Local\Programs\Python\Python37\lib\site-packages\sqlalchemy\orm\attributes.py", line 275, in __get__
return self.impl.get(instance_state(instance), dict_)
File "C:\Users\Jamy\AppData\Local\Programs\Python\Python37\lib\site-packages\sqlalchemy\orm\attributes.py", line 669, in get
value = state._load_expired(state, passive)
File "C:\Users\Jamy\AppData\Local\Programs\Python\Python37\lib\site-packages\sqlalchemy\orm\state.py", line 632, in _load_expired
self.manager.deferred_scalar_loader(self, toload)
File "C:\Users\Jamy\AppData\Local\Programs\Python\Python37\lib\site-packages\sqlalchemy\orm\loading.py", line 913, in load_scalar_attributes
"attribute refresh operation cannot proceed" % (state_str(state))
sqlalchemy.orm.exc.DetachedInstanceError: Instance <Currency at 0x18b6af23278> is not bound to a Session; attribute refresh operation cannot proceed (Background on this error at: http://sqlalche.me/e/bhk3)
yeah red that article actually, and it presume it's because my session is closed as soon as the user object is fetched. To call the .amount property of my object the session can be closed?
or does reading the object properties actually require me to have an active session?
welcome message in JS
read the docs™
How would I find which date an acc was created .js
which lib
thanks
i hope you realize there are more javascript libraries than discord.js
I was looking at guildyser
eris for example
i was refering to the "i included it in my statement" part, because you didn't
anyway, have fun with it
sorry for the misunderstanding
message.channel.send("Verifying").then(m => m.edit(`Verified...`));
let vEmbed = new Discord.RichEmbed()
.addField('Verified', `${message.author} verified.`)
.addField('ID', message.author.id)
.addField('Tag', message.author.tag)
.addField('Account Created', message.author.createdAt)
.addField('Joined', message.author.joinedAt)
client.channels.get('559457970581143607').send({embed: vEmbed})
it says it cant find the send property of undefined
discord.js
well your channel is undefined
how often can i update a rich presence field but not be considered api abuse?
1 second? 3 seconds? 15 seconds? 5 minutes?
on a bot?
i think 15s is ratelimit friendly
is say 1 alright?
not sure
1200 ms is where I find a comfortable spot
cuz looking through discord-rpc examples folder
theres a unity example
which updates the presence every time a button is clicked
which can be several times a second :thonk:
and i mean, it is in an official repo
Discord will rate limit if you send too many requests too fast
the example doesnt handle ratelimits
this is the file im talking about btw
line 33
you can always rely on ratelimit headers
so if it gets ratelimited the presence just wont be updated?
It'll get updated just not instantly
so if it keeps spamming the requests it wont update at all?
Anytime discord ratelimits my stuff, it just takes longer for things to go through
you need to block, wait for the ratelimit to expire then requeue the request
the library is more than likely doing that @dusky marsh
the linked example doesnt do that
You rite
it isnt meant to

its up to library devs to implement ratelimit handling
shouldnt ratelimited be something thats implemented in an official repo?
I would assume that the cs lib has that
it doesnt
Mega oof
That's p bad on their part
🤷
got any idea why i get this error? (discord.py)
what python version?
do
await client.send_message
however go to rewrite
its better
yes
@real crystal
i tried await client.send_message got the same message
ok so, I have this code and I keep getting DiscordAPIError: Unknown Emoji. anyone know how to help?
msg.react("👍")
msg.react("👎");
})
wrong file encoding
wym
true
im moving the bot soon to a laptop i got 24/7 open
btw if i will move to the rewrite one i will have to change some stuff
move it to a vps
eh idk i don't think i should after all this bot is just to learn python basics i will most likely stop developing it next year
selfhosting is fine as long as you know you have a stable internet connection
my internet connection is good and i wont even run the bot 24/7 only if the bot will actually be on some servers other then mine maybe i will but you know its just for self education
how are you planning to gain servers if you don't even host it 24/7
they just said its private, indirectly
If it's private, then why would it go on the list
i have no idea
discord.js
hey so my bot is having a issue with its prefix
the prefix is "j!" and defined in a json file
i looked at a couple tutorials to make sure I was doing it right and it doesnt seem wrong
doing a command like j!help works fine but it also responds to other prefixes like l! or i!
no idea why it does this. any ideas?
how do you check if the message starts with your prefix ?
if(!msg.content.startsWith(prefix)) return;
if(!msg.content.startsWith(prefix)) return;
if(!msg.content.startsWith(prefix)) return;
i meant spicy
if(!msg.content.startsWith(prefix)) return;
if(!msg.content.startsWith(prefix)) return;
if(!msg.content.startsWith(prefix)) return;
if(!msg.content.startsWith(prefix)) return;
if(!msg.content.startsWith(prefix)) return;
if(!msg.content.startsWith(prefix)) return;
wtf
Fuck oops
uh i forget
@ spicy have a look in your code and show us or look what pete wrote that will work aswell
dont have my code on this computer
also other question
so whenever i set my bot's activity to streaming it says playing and the status color stays green
but when you click on the bot's profile picture it says streaming
??? What am I fucking doing wrong???
https://i.dcorvi.pw/u/0s54q.png
Do js const prefix ('./../../config.json')
Nope.
You certain?
Yeah.
It's spitting the same error, so it's something else than the ready event.
...
It was because of something in the eval command.
Wot.
Show eval code
It's fixed now. I removed the line causing it. But now I'm getting the damn "prefix is not defined."
Your setting prefix equal to the config 
function removeSpecials(stringValue)
{
let returnString = "";
const lowerString = stringValue.toLowerCase();
const upperString = stringValue.toUpperCase();
for (let i = 0; i < lowerString.length; ++i)
{
if (lowerString[i] != upperString[i] || lowerString[i].trim() === '')
returnString += stringValue[i];
}
return returnString;
} ```
exports.promptQuestions(speaker, channel, callback)
{
channel.send(`Are you sure you want to run this command?`);
const isResponse = msgObjTemp => msgObjTemp.author.id == speaker.id;
channel.awaitMessages(isResponse, { max: 1, time: 1000 * 25, errors: ['time'] })
.then((collected) =>
{
const response = collected.first();
if (/y[aeiouy]+?[sh]|y[aeiy]+?\b|\by\b/.test(response.content.toLowerCase()))
{
channel.send('your request has been processed');
callback(true);
} else
{
channel.send('your request has been cancelled.');
callback(false);
}
})
.catch(() =>
{
channel.send(`your request has expired`);
callback(false);
});
}```
callbacks in 2019
Whats wrong with callbacks tho @blazing star
nothing i just like async functions tho
imagine using callbacks instead of await when youre already using promises
Aaaaa no thank you
guys
how can i make the rich presence of my bot change every 10 sencods?
bots cant use rp
Use a setInterval @earnest phoenix although I’d do it every 30 seconds
Possible only 5 times in a minute
i have a question...
how long does the approval usually take?
#502193464054644737 and usually a week depending on how long the queue is
ok thx
and also why are some newly added bots in #logs dont have names?
they only show the client id
Cuz they aren't in the server
You share no servers with them, hence, your Discord can't load the user info properly
And if you share a server with someone and when mentioning them they appear as user ID, blame your Discord cache
lol
For Post Stats to Discord Bot List.
its this right
client.on('ready', () => {
setInterval(() => {
dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
}, 1800000);
});
Please properly format your code blocs (put js right after the first three backticks)
How come even though I add a width and height to my iframe, it still appears as big as possible?
<iframe width="560" height="315" src="https://www.youtube.com/embed/gfc14Js0XIM" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
nvm think I got it but the 1800000
is that milliseconds?
yes
anyway if you are looking to make an android app then go for android studio
If i want to start making a app how would I? and what software do you recommend anyone may answer this question
read above tho
what type of app are you trying to make?
you could also use something like flutter
client.shard.fetchClientValues('this.guilds')
``` Any idea why this returns: ``` for (const prop of props) value = value[prop];
^
TypeError: Cannot read property 'guilds' of undefined```
anyone got docs for discord.js-lavalink ?
Idk if this is the right channel or not but I keep getting errors from webhook when I try to shard my bot? Something about the port is allready in use? Any ideas on how to fix this?
use a different port
Well the port is allready in use when I use multiple shards
So I need to use different ports on the different shards?
Discord.js
oh im sure there is a way to do that in the non-shared code
It is working fine without sharding
Yep
Any idea on how to fix this? I have taking a look on the docs but that did not help me
Because I did not mean it that way lol
Still on starboard anyways
can you restate your question tho?
I am getting a port error from the webhook when I try to shard my bot. How do I shard my bot without getting the port error from the dbl api?
Using discord.js
only run it on one shard
Does it not need to run on all shards?
Well the bot needs the dbl api on all shards
That is the problem
I am checking if the user has voted sometimes
You dont need a webhook to check for votes unless you manually save it to a database
the webhook is only for receiving votes
You dont need to run the when you create a dbl iirc
if you just provide a token you can use it's methods
Ah
Gotcha
Thanks
if (client.shard.id == 0) {
const DBL = require("dblapi.js");
const dbl = new DBL("TOKEN", {
webhookAuth: "Na",
webhookPort: 5000,
});
client.dbl = dbl;
} else if (client.shard.id != 0) {
const DBL = require("dblapi.js");
const dbl = new DBL("TOKEN");
client.dbl = dbl;
}```
That would work?
client.shard 
Yea?
Is that actually an attr
Ill give it a try
Noted
I have my own lib, I havent looked at dblapi.js in a while so it may not
I get a thrw error about a connection not made in 15 seconds when people do my connect command.
if(!message.guild.me.hasPermission('CONNECT')) return message.channel.send('bruh did u really remove my perms')
if (message.member.voiceChannel) {
// check if there is already a voice connection
if (message.member.voiceChannel.connection) {
console.log('conn status: ' + message.member.voiceChannel.connection.status);
}
console.log('is joinable: ' + message.member.voiceChannel.joinable);
if (message.member.voiceChannel.joinable) {
message.member.voiceChannel.join()
.then(connection => { // Connection is an instance of VoiceConnection
message.reply('I have successfully connected to the channel!');
})
.catch(console.error);
}
} else {
message.reply('You need to join a voice channel first!');
}
}```
how to fix
ı have a error "FFMPEG not found" but ı have ffmpeg
Help me. My bot isn’t responding to anything for some reason. Errors point me to this code having an issue
(Will send code one second)
So my bot won’t send messages
And logs tells me it’s something wrong with this
if(message.channel.type === "dm") return;
let prefixes = JSON.parse(fs.readFileSync("./prefixes.json","utf8"));
if(!prefixes[message.guild.id])
prefixes[message.guild.id] = {
prefixes: botconfig.prefix
};
let prefix = prefixes[message.guild.id].prefixes;
console.log(prefix);
let messageArray = message.content.split(" ");
let cmd = messageArray[0];
let args = messageArray.slice(1);```
Is this rewrite ;-;
No
discord.js right?
Yes
Let me take a look at it
Mm that would explain why it looked weird
lol
I use py
I used to use it, got quite bored and changed to js
meh
but anyway, what do the errors tell?
I like creating small games in py
Lemme get a pic of the error
kk
xd
how about not using json for a database as a first
yes
that is long file lol
but dont use json as a database in the first place
then migrate
Woah
I didn’t use the Json as a database, but I had to add it for a prefix command
Aren't you using it for saving prefixes?
So, that kinda makes it a db
still, that's not the real problem here
Hmm
Did you change the json file manually?
its the root of the problemlol
waoh
it's just invalid json 🤷
Oh well, just don't use json next i guess
:I
¯_(ツ)_/¯
I use json and it works fine xd
Yeah welll thx for helppp
Yep just cleared it’s database and now it works again
wack
xd
I’ll have to fix that, wether it be through a different database or better system
I mean if it's just to store player health values and weapon names then I thinkies it's fine
typing intensifies
It’s for storing prefixes
It's not like I'ma need to soon migrate to a 64 gb micro SD card
why json is bad:
it is not meant to be used as a database
its a file, the size will grow a lot over a short period of time
its a file, you cant edit/read in parallel (async)
huge risk of losing data
^^^^^^
If data is lost the user can just create a new profile
I can easily relate
And it always deletes the file and recreates it
so youre saying you would rather risk data loss than your time
It's more efficient than individual .txt files
Well it’s just prefix storage. It doesn’t really hurt me if I lose it
you don't need text files?
It can store more at once
so can text files
json is a b**ch
*bench
totally what I meant
if youd risk data loss over your effort to migrate to a proper database you dont deserve to be a dev in general 🤷 its security 101, speaking of which json isnt secure, like at all
Lol @signal yarrow
Security 101:
Step one: Backup files to onedrive
Step two: erase old files
Step three: discover that onedrive didn’t even save ur files and you lost everything
Step four: die a slow death
We don’t speak of git
aight, git it is then
im gonna use git for my database 😎
not as a database
I think that was a joke lol
I know it was a joke
some 0 year old is gonna come here and not take it as one
start using github as a database
github best db
How could I make a button when clicked make something appear and when clicked again it will go away
This is my code so far
<script>
function appearFunction(){
document.getElementById("form").style.display = "block";
}
</script>
change the visibility to hidden
Well I know that
But how would I go about doing that?
Cause so far as I see it when it is clicked it only makes it appear
and when clicked again it does nothing except keep the thing therre
if its showing, hide it
if its hiding, show it
style.visibility = 'hidden'
check if visible, if yes, change to hidden. if no, make visible
Ah ok thanks
can someone help me?
@torpid dew never just ask for help, always just ask your question and make sure you mention the lib & version, and the code and error if applicable
see channel topic pls
Post your actual problem, and we will help solve your problem
i dont know how to code and i need help making a review bot so you type in the prefix
"F" and then after f do review and then it will pull up a reaction box and the bot will keep count of all the reviews
so i want to do "{review" and then it come up with a menu and the menu will be like how many stars 1-5 and then after that i want it to say what is the description the review
then you put your review in the description and the bot will keep track of all the reviews
i need help coding all of that
my question is what do i need to type in to code the bot to do that
that doesnt sound like asking for help, that sounds like "make me a bot"
idk what to do can someone teach me a little bit on coding then?
function appearAndDisappearFunction() {
if (document.getElementById("form").style.display = "none") {
document.getElementById("form").style.display = "block";
} else if (document.getElementById("form").style.display = "block") {
document.getElementById("form").style.display = "none";
}
}
Probably stupid question
But this is not making it disappear only appear
when the checkbox is clicked
Can anyone tell me or give me a hint as too why?
never changing the visibility to hidden
Oh?
style.visibility = 'hidden' hides
Ah ok
check if vis is hidden, not if display is block
also this is a solid google question
https://www.w3schools.com/howto/howto_js_toggle_hide_show.asp
apparently style display block and none works
ive only ever used visibility, but theres another option
i think visibility makes it transparent vs removing it
which is why ive always used that for popups
sorry, my css is rusty i havent done front-end in a while
all the properties blur together after a while haha
Lol yea
Same here
This is why I am having so much trouble
I am forgetting things
uwu
.
.-.
@bitter sundial i need advice
why mention me
because ur IQ is over infinite
im trying to use the DBL server count
oh wait
it fixed itself
delayed 😂 sorry for ping
lol
regarding modlogs, how would I ignore the ban/kick events when they were executed with a command?
since theyre events, i dont think you can
@ruby dust You can check if the action was done by your bot and just return;
.
.
<label class="checkbox is-2" onclick="toggleFunction()">
<input type="checkbox" name="Dev"/>
Developer
Any ideas on how I could make it so when they click the word developer it runs that function as well?
Because you can click the word by the checkbox and the checkbox will be checked but it doesn't run the function unless you actually click the checkbox
and I want it to happen if they click the word or the checkbox
@lusty dew iirc you can do that by putting "Developer" in an <a> tag and adding onclick="myFunction()"
Thanks!
Well damnit.
Using the <a> it isn't allowing me to text in the form I have
it just makes the form disappear
<label class="checkbox is-2" onclick="toggleFunction()">
<input type="checkbox" name="Dev"/>
<a onclick="toggleFunction()">Developer</a>
<div class="field" id="form" style="display: none">
<label class="label">Label</label>
<div class="control">
<input class="input" type="text" placeholder="Text input">
</div>
<p class="help">This is a help text</p>
</div>
The toggleFunction() makes things appear or disappear
Well maybe™ <a> isn’t supported in forms, not sure, but you can just use a button?
You can put onclick in every element. Just decide where you want it to be clickable
You can put almost anything inside a form, I includeding <a>
I’m trying to get my bot to respond with a question and use the reactions for a review bot and if you give me a sec I can send you the code I have
const Discord = require('discord.js')
const client = new Discord.Client()
client.on('message', (receivedMessage) => {
if (receivedMessage.author == client.user) { // Prevent bot from responding to its own messages
return
}
// You can copy/paste the actual unicode emoji in the code (not _every_ unicode emoji works)
receivedMessage.react(" :thumbsup: ")
receivedMessage.react(" :thumbsdown: ")
// Unicode emojis: https://unicode.org/emoji/charts/full-emoji-list.html
// Get every custom emoji from the server (if any) and react with each one
receivedMessage.guild.emojis.forEach(customEmoji => {
console.log(`Reacting with custom emoji: ${customEmoji.name} (${customEmoji.id})`)
receivedMessage.react(customEmoji)
})
// If you know the ID of the custom emoji you want, you can get it directly with:
// let customEmoji = receivedMessage.guild.emojis.get(emojiId)
})
is that right?
i asked a friend and this is what he gave me
i am trying to add new commands to my new bot i am working on with discord.js but when i try the command i get this
learn javascript properly first
there are great learning resources pinned in this channel
go to #502193464054644737
random guy jumps to bot development without training... why is this even a mainstream? why do people don't ever learn?
I'm a fast learner but nothing on YouTube to help or teach me
youtube isn't that well with helping
that's what I also though, but programming languages are far more complex than you think
Reading your thing rn frito
Just its formatted weirdly on mobile lol
lol
do everyone a favor and learn the language first, that will save time for both you and us
By the looks of it that should work (not really done much in terms of using reactions)
If you wanna use the reactions tho pretty sure you can set up a reaction collector in discord.js
okay i just is wondering if it would work
was this whole message supposed to be a whole url? lol
Hello
Trying to make a server but having trouble with it
Don’t own a computer only have my iPad Pro
Want to make my server for drone flying people
Can I get some help?
Wait making a discord server?
Yes
Left hand side of the app, under the servers you're in is a plus button
Let me look
...... oh gawd I’m a idiot
I’ll probably be back for help setting up bots
:p
This channels for development though so thought you were gonna say you were trying to run an actual server off an iPad pro
No
show us the error and we'll try to help
that's not what i meant
?
what does it bring up on the bot's console?
Console : good
Hello everyone I want to ask how to make a web like an example
discordbots.org / api
what is that?
How do I make /?
Y
thats called a path
dbl is probably built on top of node
frameworks like node and asp.net create virtual paths
Hey guys. how can i listen on when a certain emoji reaction is triggered anywhere on any server? should i call the msg.awaitReactions method on every message on every server for that?
which lib
discordjs
Thanks!!!
Another question. When i extract emojis from a msg.content i get the unicode format in my code and when i save it to database it shows "???". I would like to not get the unicode format but simply retrieve the ":emoji:" string value and save to my databse. is this possible somehow? the emoje object does not seem to contain an extra field for this.
so i have to change encoding or smth for my database`
yeah
you can also make an array of unicode - > emoji names but that would take up a lot of time
its not
your client is what does the :emoji:, the api keeps everything in unicode and for a reason
haha yes why use tens of characters to store an emoji instead of 4 bytes
ok sorry
a vps
.-.
he told you to read pins
get it, but where's the cheap rent?
it's literally $3 a month
You know the site?
did you even read pins
okey this is strange. so i need to write an emoji to my database via a command. when i write ❤ is shows the correct symbol in my database, but with any other (fe 😄) its shows only "???". what can it be? its mysql on utf8_general_ci
If you get it back from the database and send it to discord does it still show ???
perhaps google "mysql emojis question marks"
hi
Uhh I need help
that doesnt help us help you at all
need help with what?
Well I'm trying to set up my server on discord server list and every time I click submit it gives me a 500 error
this is meant for bots, not discord servers
I know but the other server is dead so
so
this is still for discord bots lol
Hi :D. Currently I'm not able to find a solution how to log deleted messages with JDA. The GuildMessageDeleteEvent gives me no solution how to get the previous content of the message. How did you solve this?
Let's say I have this. Would the console.log() in alpha.js show up as "foo.js", "bar.js", or "alpha.js"?```js
// foo.js
export class Foo {
get name() {
return __filename;
}
};js // bar.js import Foo from "./foo.js"; export class Bar extends Foo { // stuff };js
// alpha.js
import Bar from "./bar.js";
const thing = new Bar();
console.log(thing.name);```
can i check somehow if something (certain part of the user entered message) is a valid emoji, that can also later be used on the respective server by the bot?
discordjs
you need to validate it yourself
loop through all emoji codepoints and see if there is a match, alternatively use regex
@willow marlin thats because discord doesnt actually send the message data when its deleted
they only provide the id that was deleted
what you need to do is to cache the messages you receive and then pull from the cache when you get a message that one was deleted
msg.client.emojis, as well as
msg.guild.emojis
returns empty collections 😦
Ah, okay. Thanks, @hushed berry 😃
thats meant for custom emojis
i think this is my 3rd time telling you that builtin emojis are unicode and you need to loop through the string yourself and check for codepoints
so i need some predefined imported list of all valid emis
yes
i believe there is a prebuilt regex somewhere that does that already for you
ok thanks
Now I want to cache my messages within a LinkedHashMap. What should I take as the maximum stored messages? Or may I make it with no limit?
Or should I use another algorithm to cache my messages?
!futte
wrong server
where is the cheapest RDP/you know? so i can have bot up 24/7 there`?
ty
does sharding duplicate all loops and process for each shard?
like does it duplicate all files and process bot uses or will it just split workload of one instance of those files across shards
I only run intervals on shard 0
from that
its a pretty garbage tutorial
ngl
i have a lot of automated processes like cronjobs and loops i dont want to duplicate multiple times
Then run only on shard 0 
how would you go about specifying which shard handles that?
one sec ill just do testing
this is what I do 
Hi uber lol.
This guy smh smh
why wouldnt it
means i got to refactor my entire backend 
it starts the script multiple times
im just not even going to bother until its required of me
but im adding sharding support to the bot framework
so when your bot will be offline because it cant connect to the gateway 
exactly so why not work on it now 🤔
more important thing
is there a way to start each shard on individual pm2 process?
doubt
ive seen it done
Yeah you can shard without the internal D.Js stuff
unless you start it a bunch of times with different data 
Like across servers
makes sense
add it to your framework thing
Oo
Didn't need to add it 
Time to steal be inspired by your code
if i leave .spawn() empty it just auto shards correct?
ye
@earnest phoenix if you use discord.js internal sharding then it only uses 1 process and 1 client
how would i go about that?
only external sharding (ShardingManager) uses multiple processes and clients (and you have to mess with broadcasteval and stuff)
what d.js version do you use
latest (11.4.2
updating out of stable
even tho it's basically stable anyways
yeah switch to master
npm i discordjs/discord.js
fyi you will probably need to update ur code
ah k
how would you internal shard on master tho
its simple
just set shardCount: 'auto' in d.js ClientOptions
and it will handle sharding stuff for you
so in new Discord.Client?
yeah
oh
not auto shard
well in internal sharding all shards are in 1 process
but shard count is a number
yes but 'auto' works too
There is a way to split a bot across multiple servers with d.js, no?
would client.shard still work with this cuz I really dont want to rework a bunch of my stuff atm 
👀 this looks neat
That looks cool
i didnt want to deal with external sharding so i just used internal when i first sharded
it wasnt that hard tbh
Does anyone use @sentry/node over the NodeJS Raven? Raven got deprecated and I am trying to find the equivalent of Raven.context()
yeah
cuz internal sharding is only supported on master
cool beans
oh yeah master has some weird deprications
@bright spear any way to know the current shard your on etc with the internal sharding?
as well as get data from all shards etc
Anything on client is from all shards
oh really?
sweet
ok
so i dont have to do any funky stuff
to access other shards etc?
awesome!
You can get the amount of shards though
client.ws.shards.size
so with internal sharding client.guilds is all guilds and you dont need to client.broadcastEval?
Yeah
yea this is legit cool
wait
will it duplicate loops?
like the shard manager did?
Wdym
like if i setInterval will it duplicate it when a new shard is spawned
It doesnt run the process multiple times
I wouldnt think so
Yes it's only one process
but I use external so not really sure
Afaik there's no duplication stuff
Well 12 is technically not not "stable" yet
It works fine tho
I've only used 12 and all my bots use it
I think Imma stay on external sharding even when it becomes stable because I dont wanna redo anything 
Lol
wait but wouldnt that break dblapi.js?
Wot
@still karma that means this framework bouta push will auto shard and you dont have to do any funky stuff
woot
I just use blapi, I contributed internal sharding support to it
needed to know if that would break my lib
lmai
lmao*
I dont support shard data tho, it just posts guild count 
Lol
Moose is a bot?
@still karma is
i did?
TIL
woot
thx for this internal sharding dark magic
way better then alternative
Console say
Error: Cannot find module ‘discord.js’
@earnest phoenix I install 10 times
But same
I install npm install, npm install discord.js
is that glitch?
you cant just install modules like that on glitch
you have to put them in as dependencies in package.json
I have a problem with mention prefix just the problem are when i do @MyBot ping its not working and when i do @MyBotping its working
@earnest phoenix you're going to need to provide more details. Show us the code in question, explain more about what's happening vs what should happen, etc.
const mention = new RegExp(`^<@!?${bot.user.id}>`); const prefix = message.content.match(mention) ? message.content.match(mention)[0] : "blablabla"

you see that const prefix part right?
yes
not working
neither?
i want to make my own rich presence how to make
I'm trying this
const mention = new RegExp(`^<@!?${bot.user.id}> `); const prefix = String(mention).match(message.content) ? message.content.match(mention)[0] + " " : "blablabla"
idk worked for me
any py developer here ?
Yes
With discord authentication, after the user signs in and you have the "code", you can get the access token and refresh token. How do you use the refresh token? What's the grant type?
https://discordapp.com/api/oauth2/token?grant_type=authorization_code&code=${code} doesn't seem to work
alright i messed with the first part and lost that too
What's wrong with:
app.get('/api/callback', async (req, res) => {
if (!req.query.code) res.redirect('/')
const code = req.query.code;
let data = {
'client_id': CLIENT_ID,
'client_secret': CLIENT_SECRET,
'grant_type': 'authorization_code',
'code': code,
'scope': 'identify'
}
let response = await fetch(
`https://discordapp.com/api/v6/oauth2/token?code=${code}`,
{method: 'POST',headers: {'Content-Type': 'application/x-www-form-urlencoded'},json: data}
);
let json = await response.json();
res.redirect(`/api/store?data=${encodeURIComponent(JSON.stringify(json))}`)
});```
from <https://discordapp.com/developers/docs/topics/oauth2#authorization-code-grant-access-token-exchange-example>
where is the code to display the server count found here
https://gyazo.com/0a6515bad253768ff4fdb9f81add48d4
is it this?
const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('Your discordbots.org token', client);
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
Update: code now looks like this (still not working)
app.get('/api/callback', async (req, res) => {
if (!req.query.code) res.redirect('/');
let data = {
'client_id': CLIENT_ID,
'client_secret': CLIENT_SECRET,
'grant_type': 'authorization_code',
'code': req.query.code,
'redirect_uri': "https://discord-backup.glitch.me/api/callback",
'scope': 'guilds'
}
let response = await fetch(
`https://discordapp.com/api/v6/oauth2/token?code=${req.query.code}`,
{method: 'POST',json: data}
);
let json = await response.json();
res.redirect(`/api/store?data=${encodeURIComponent(JSON.stringify(json))}`)
});```
@earnest phoenix it auto posts when you create a new instance of DBL
so I just add this in?
const dbl = new DBL('Your discordbots.org token', client);
yes
I have that in my code already but its still saying N/a
you have changed the 'Your discordbots.org token' right?
yes
¯_(ツ)_/¯
try posting your error in #topgg-api
There is no error though
i mean your non-working code
you'll probably get more people, who know what they're doing, seeing it
Code works and what not
but I guess
try waiting as well
sometimes it takes some time to update iirc
so when i do member.send("msg") what does member find to dm it??
trying to have it dm me instead of righting the error in console
he will find msg
U py developer?
discord.js
what will i need to have it dm me errors
rn its set to consle.log(err)
but i want it to dm me so i see them so i dont need consle up
try and catch
i learn by doing im slowly learning discord.js
try and catch is js
not discord.js
try{
member.send("smth")
}catch(e){
message.channel.send(e)
}```
but if i do member it would dm a member when it errors out what do i need in members spot to only dm me
my tag, name, id?
that wouldnt send the error
message.author.send(e)
message.autor does that find id, tag,
wtf u talking bout
message.autur is the person who said something i dont want it sending errors to them i want it coming to my dms
im doing a let statment to find me but i need to know if i need my tag or id or @tag
nope
wat u mean nope gamearoo
i dont understand wtf u are trying to do
use try and catch
to get the error
the rest idk what u want
ok think of the u run a command to msg me the bot owner how would i set that up to have it dm me even tho im not in the server'
ex a.feedback would dm me the feedback even if im not in the server
bot.users.get("urid").send("smth")
let errUser = bot.users.get("171373018285735936")
errUser.send(ERR)
nothing was sent to dms
i want it coing to me even if im not in the server
wat ERR is define as?
i have a cmd set to error out so i can test it on the test bot
can u just give ur whole code
so basicly athat error
do u know what member.send() would look like if so replace member with the thing that will allow it to dm
member is the user doing the cmd i want it coming to me not the users dm
idc bout that i just want to see ur code thats not working
console.log(member.user8.tag + ` Joined ${member.guild.name} which the bots on`);
let gRole = member.guild.roles.find(`name`, "Member");
member.addRole(gRole.id);
member.send("Welcome To: " + member.guild.name + " Please Enjoy Your Stay :)");
let welcomechannel = member.guild.channels.find(`name`, "airi-sena-welcomes");
if(!welcomechannel) return;
let welcome = [` LOOK OUT EVERYONE ${member} JUST JOINED THEY SEEM OP PLZ NERF!!!`, ` LOOK OUT EVERYONE ${member} just joined. Can I get a heal??`, ` EVERYONE Roses are red, violets are blue, ${member} just joined this server with you!`, `EVERYONE ${member} just joined HOLD MY Sprite Cranberry `, `Everyome ${member} Just Joined What should i get to help him??`, `It's dangerous to go alone, take ${member}` ];
let result = Math.floor((Math.random() * welcome.length));
welcomechannel.send(welcome[result]);
member.send(`Welcome To ``${message.guild.name}`` `)
bot.users.get("171373018285735936").send("test")
});```
\
thats just so i can test
trying to get that line to be dmed o me
u dont even have try and catch
wtf
how u want to get bot to dm u
if there is error
and deprecated find method
@eager kite bot.on("ready", async () =>{ try{ bot.users.get('171373018285735936').send(`${bot.user.username} is online!`) }catch(e){ console.log(`${bot.user.username} is online!`) } }); still no work
dm me for errors and start
Maybe their first language isn't english?
im english i have autism a learning disability
Ah ook
so it may come out confusing
he trying to get smth
have my bot dm me on errs, and on start
at the start?
He wants his bot to dm him when errors occur and when the bot logs on
basicly instead of it going to consle it comes to my dms
but hes using ready event
Easy
use try and catch
He is
but that code will never reach at catch
He is just not doing it right
bcz there is no error
bot.on("ready", async () =>{
try{
bot.users.get('171373018285735936').send(`${bot.user.username} is online!`)
}catch(e){
bot.users.get('171373018285735936').send(`${bot.user.username} is online!`)
}
});
look at that code i edit a bit
u must do smth wrong
at that try scope
u didnt help me
<a onclick="toggleFunction()">Developer</a>
<div class="field" id="form" style="display: none">
<label class="label">Label</label>
<div class="control">
<input class="input" type="text" placeholder="Text input">
</div>
<p class="help">This is a help text</p>
This isn't allowing me to type in the text box at all
whenever I clcik on the text box to try
it toggles the checkbox and it makes it disappear
didnt even add the log dm to it
its not working even without the adon
im trying to fix the bwelcome msg
bot.on("guildMemberAdd", async member => {
let gRole = member.guild.roles.find(`name`, "Member");
member.addRole(gRole.id);
member.send("Welcome To: " + member.guild.name + " Please Enjoy Your Stay :)");
let welcomechannel = member.guild.channels.find(`name`, "airi-sena-welcomes");
if(!welcomechannel) return;
let welcome = [` LOOK OUT EVERYONE ${member} JUST JOINED THEY SEEM OP PLZ NERF!!!`];
welcomechannel.send(welcome);```
its not working as is why would i try to log
can someone help plz
my wifi sucks so i can just google search a fix this time
Use ids instead of names
``` if (message.content.toUpperCase() === prefix + DAILY) {
message.delete();
if (money[message.author.username + message.guild.name] != moment().format('L')) {
money[message.author.username + message.guild.name] = moment().format('L')
money.updateBal(message.author.id, 500).then((i) => { // The daily ends of the day, so everyday they can get a daily bonus, if they missed it, they can't get it back again.
message.channel.send({embed: {
color: 3447003,
description: 'Recieved your $500 `!daily\. I think you should check \!money`.',
author: {
name: ${message.author.username}#${message.author.discriminator},
icon_url: message.author.avatarURL
}
}});
})
} else {
message.channel.send({embed: {
color: 3447003,
description: 'You already recieved your `!daily\. Check later **' + moment().endOf('day').fromNow() + '**.', // When you got your daily already, this message will show up. author: { name: ${message.author.username}#${message.author.discriminator}`,
icon_url: message.author.avatarURL
}
}});
}
}
});```
THIS COMMAND NOT WORKING
define "moment"
ok
- please use a real code block (
```js
code
```
) - chill on the caps
ok
- Read the error because it actually tells you where it is
^
define what do you mean by "notworking"
i wright
error message if anything
how did you define moment
unless you are putting that moment somewhere weird
it should be defined
make sure you saved file after defining moment too
var moment = require('moment');
btw you can use const on it if you don't want to change it again
Can you help with dbl-api
(node:8868) UnhandledPromiseRejectionWarning: TypeError: dbl.getBot is not a function
What am I doing wrong?
God
Hmm
It?
What
Please use ids and not names..
Use DBL.getBot(), not dbl.getBot() @open flicker
See how many duplicates the name Discord has
But my bot will not work even I change user into id
Why?
can someone help me
Because it's unique shit
how can i turn the server list bot online on my server?
Lmao
you can't turn it on..
@pallid zinc it will not work because you will lose all the data
there might be a hosting or bug issue with it that DBL devs are looking into
@lunar wasp only owner of the bot can
you used name, migrating to id would need a reconfiguration
@pallid zinc its offline in my server
Bot is off
you need a program to make a bot run
@lunar wasp only in your server
@pallid zinc what do u mean
Bot is off only in your server
ye
Lmao
I dont think you even use shards
when will it be back online
could be not only in your server but on all servers