#development
1 messages ยท Page 1768 of 1
It was actually insane difference going from Python/JS -> Go. The performance increased and size of the code diminished by 10x
message.channel.overwritePermissions([
{
id: message.guild.id,
['SEND_MESSAGES']: true,
},
really??
like this?
I have worked with both, and if the code base was 10x smaller in Go, then the JavaScript must been written pretty poorly. Just being honest.
I have generally found the inverse to be true.
I should have clarified. The actual code itself was larger due to the strongly-typed nature and GO practices. The actual COMPILED code was 10x smaller.
But go definitely performs faster
Yeah, youโre definitely correct.
https://i.callumdev.xyz/kl9l1.png
How can I have song data show up here? I have seen loads of other sites do it and cannot figure it out.
I meant to clarify that the compiled code was 10x smaller
50mb for Python ... while 5MB in GO
Iโd still choose JS/Python over the others due to the vast support from third party libraries & documentation
MediaSession api
The title does not seem to work, and continues showing page title?
https://i.callumdev.xyz/bfpdm.png
what's the code?
whats the python import for buttons?
Although undocumented, buttons are available in the library's master branch on GitHub.
and the title property has a value, yeah?
yup
strange
maybe it's some kind of a cache?
try incognito or clearing the website cache
๐ seems to have done the trick, how odd, but not complaining ๐
well it wont be issue for end users anyway
Why i can't split catch error content?
wdym?
like try {} catch(err) { err.split("") }
INSERT INTO user_accounts(email, hash)
VALUES (randomemail, emailhash);
ERROR: column "randomemail" does not exist
LINE 3: VALUES (randomemail, emailhash);
if u care about size, go low level language of high level languages
I can figure out what I am doing wrong
i assume randomemail and emailhash is a variable in your code, sql cannot simply access them
You need to get the message of the error first
hi and speak Spanish??
It's <Error>.message I believe
hello
hello
what do you need help with?
yes
If you cannot speak english, you can ask for help in #general-int
con que necesitas ayuda
yeah, that's it?
why do you want to split the error though
hi
does anybody know how can i make a WebSocket on my website?
i mean
i know how to do it in localhost
but idk how can i make my url a wss://
Anybody teach me coding
probably wont find a teacher here, best bet is to hire one or learn on your own.
What do you want to learn? We won't teach you, but we can point you to resources to learn on your own.
Web development
Reply
Hi, i have made about 10 tasks.loop() in my bot (each one has a separated role)
so like when i tried calling them like this
if __name__ == "__main__":
if not taskName1.is_running():
taskName1.start()
if not taskName2.is_running():
taskName2.start()
#And so on with the rest of the tasks
client.run(TOKEN)```
the problem is the bot goes offline after 5 minutes
no errors, and in the terminal it shows the on_ready message
Then you may want to learn JavaScript.
Try enabling the debug log and see if something by any chance is blocking.
alr
But you can teach me
Nope.
Can anyone teach me coding
Nope.
Anyone else
actually i never used it before, i am not sure if i am doing it right
I am your brother pls teach me coding
Wow it's almost as if you didn't read what you didn't like
We will not teach you
@slender thistle I AM UR BROTHER, PAY MY COLLEGE TUITION
like it was said multiple times
lol
I am happy to give you $10k in loans and suck $60k by the end you're done.
Hell nah
this isnt a teaching server, its unrealistic to expect us to teach you
Because:
- We are not a teaching place. You have the internet and online courses for that;
- We aren't obligated to;
- It's time and effort, and that's paid. And I doubt you're gonna pay anyone here to teach you.
If you expect to be a good developer, learn to be independent
https://discordpy.readthedocs.io/en/stable/logging.html This will log it when something is blocking the main thread
alr
Or git gud at stackoverflow
Asking for help is one thing. Asking someone to give you everything on plate and break it down to you is a different story
Eugh. Back to suffering with episode scripts.
ptsd is fun init
It's not PTSD, it's pain of trying to come up with creative ways to deliver shit to people without sounding repetitive
i got the solution for u
I know you have beer
does anyone actually use that
talking about the contents of the tag
of THAT specific tag?
yes
yes, i do and a lot
@earnest phoenixso does it automatically print or do i have to do print(something) ?
evie is more sophisticated and has a link instead
i just yolo and post the whole thing over again in a massive wall of text
debug mode will log everything
well, mostly everything
it didn't tho
evie is more sophisticated and has a link instead
i just yolo and post the whole thing over again in a massive wall of text
single source of truth vs. multiple sources of truth
impossible
wot?
the contents are the same
just get it pinned /s
what's the issue again?
@misty sigil heres another
Pls lien ftnl
and it's still running
what?
yes, but actually no. look up the two models :^)
the fuck's that
huh?
I am french
they. are. the. same.
Je veux le lien du >bot ftnl
french in #general-int
maybe one of the tasks is deadlocking your bot
You can actually just manually check though if something is blocking by inspecting the code
another what
hmmm
I made the comparison as a joke but I don't think you see the difference between the two
remember python is pseudo-multithreaded
Anyway, if you setup the log properly, it'd debug something like this
oh
no, you need to find what is hanging the process
another incompetent dev as well :โ)
use debug mode with breakpoints to see where it's stopping
i previously used the same tasks but in functions
oye! i didnt call ur mom names 
like
class AutoActions():
def __init__(self):
pass
async def fucntionName1(self):
#etc
async def fucntionName2(self):
#etc
#same with the other 10 functions```
it was working fine but i would get a python error from it
use breakpoints
like it was looping the function
What do you do in those functions?
some auto actions like
temp unmute
temp unban
auto trivia (sends trivia questions)
and some others
what are these?
A feature for debugging purpose
like i call the functions like this ```py
try:
asyncio.ensure_future(AutoActions().functionName1()
except:
pass
```py
async def funcitonName1(self):
#Some code
await asyncio.sleep(sometime)
await AutoActions().functionName1```
if they using vsc. idk if pycharm has breakpoints
It does
then i will shut my mouth
It has breakpoints 
pycharm has eveything
recursion? 
idk how to use them
nah what are those function names seriously
oh wait
This is too vague to even understand wtf you're doing
hmm alr lemme get a pastepin lol
am I the only one who has hastebin not work 3/4 the time
use gitlab
github gists are only good when you want it tied to you
if it's just a throw-away bins are better
it's in the name
ditch github get gitlab
u can make as many as u want and they dont decay
oh
does ctx.author return the tag like @lofty cedar ? (That is actually <@! 652590649735905303 >
(Discord.py)
well it's easy to make
No, it returns Member/User object
How to return the tag?
rftm*
Since Member subclasses User, you can use Member.mention
rtfd.
m
rtfd >>
I need for who sent the message
Wtf is wrong with those branches
read the fucking docs
Yeah?
read the fucking manual.
ctx.author returns either a User or a Member
docs are manuals
which both have a mention property
docs ๐
rtfm
what branches ?
Oh my God

Tell 'em, shiv :^)

hmm is it something i did wrong?
Though apart from that, the issue might be related to your synchronous db
I feel like db methods are at fault here
oh
what are branches lol
Must be pain maintaining it
It hurts to read
if, while, etc
github has trees
if x:
# if branch
else:
# else branch
oh
I'm so tired that I can't write 4 lines without messing it up
so the main problem is with the db thing?
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
``` 
Most likely
then how am i supposed to get data from the database ?
Migrate to async driver
Make it async
hmm, may i have some examples about it?
I would import that
Well what's your db in the first place
import this
cuz like
reject imperative
nah, that
return to declarative
firebase
oh i didn't fully understand what you meant lol
i thought adding some sort of async function
Well you could slap everything into an executor
But God forbid you touch that right now
oh lol
Things probably would've been simpler
Oh, who knows
This for example, the else is superfluous
i don't think it works
it's searching for a json file
i don't have a json file lol
permissionOverwrites is not defined How can I define this? discord.js
I'm trying with permissionOverwrites = require ('discord.js')
@slender thistlei can't seem to connect it to my firebase real time database with async-firebase
more like, it works for android and ios notifications?
What's it for?
lock channel command
Are you trying to access/update a channel's permission overwrites?
exactly
permissionOverwrites.update({
'SEND_MESSAGES': true
})
.then(channel => console.log(channel.permissionOverwrites.get(message.author.id)))
.catch(console.error)```
Ah
now I'm trying with this
Huh?
It's a collection of PermissionOvewrites
Looks like you need to loop through them to access https://discord.js.org/#/docs/main/stable/class/PermissionOverwrites?scrollTo=update
https://stackoverflow.com/questions/62352260/is-there-a-workaround-for-the-blocking-that-happens-with-firebase-python-sdk-li see this probably idk
2021-05-31T17:53:41.440315+00:00 app[Worker.1]: (node:4) UnhandledPromiseRejectionWarning: TypeError: permissionOverwrites.update is not a function
Whit this I get this
SO MESSAGE.CHANNEL?
// Update permission overwrites
channel.permissionOverwrites.update({
'SEND_MESSAGES': true
})
.then(channel => console.log(channel.permissionOverwrites.get(message.author.id)))
.catch(console.error)
^
?
const channel = message.channel;
channel.permissionOverwrites is a collection
You need to loop through the items and update them individually
You can use a for loop js for (const permissionOverwrites of channel.permissionOverwrites.values()) permissionOverwrites.update(...);
Did you copy your code from somewhere?
discord.js docs
I see
why?
Try to understand the code you copied. Docs will help you if you're unsure what something is/does
this is not so easy
channel.permissionOverwrites.update({
'SEND_MESSAGES': true
})
.then(channel => console.log(channel.permissionOverwrites.get(message.author.id)))
.catch(console.error)
)));```
like this?
opsie
Uh, try to correct the syntax
idk
What code editor are you using?
for (const permissionOverwrites of channel.permissionOverwrites.values()) permissionOverwrites.update({
'SEND_MESSAGES': true,
})
.then(channel => console.log(channel.permissionOverwrites.get(message.author.id)))
.catch(console.error)
like this?
VS code
It should tell you what's wrong
with this nothing
Sorry, gotta go.
np, ty for clues
parm useless
Anyone else getting ETIMEDOUT errors from Discord's cdn?
client.on('message', message => {
if (message.author.bot) return;
if (message.content === "+invite") {
let embed = new Discord.MessageEmbed()
var user = message.author;
message.guild.fetchInvites()
.then
(invites => {
const userInvites = invites.array().filter(o => o.inviter.id === user.id);
var userInviteCount = 0;
for (var i = 0; i < userInvites.length; i++) {
var invite = userInvites[i];
userInviteCount += invite['uses'];
}
message.reply(`**has ${userInviteCount} invites!.**`)
}
)
}
});
Everyone hello I tried to make an indicator of invitations in embed but I did not manage maybe need to add something ?
first of all, remove var
never use it unless you understand what it does
use let instead
now lemme format that for better reading
client.on('message', message => {
if (message.author.bot) return;
if (message.content === "+invite") {
let embed = new Discord.MessageEmbed();
var user = message.author;
message.guild.fetchInvites().then(invites => {
const userInvites = invites.array().filter(o => o.inviter.id === user.id);
var userInviteCount = 0;
for (var i = 0; i < userInvites.length; i++) {
var invite = userInvites[i];
userInviteCount += invite['uses'];
}
message.reply(`**has ${userInviteCount} invites!.**`) ;
});
}
});
way better
so, at first glance there's this
so it's not guaranteed to have an inviter property
also you can simply do invite.uses
other than that, remove vars
@earnest phoenix
const userQuery = {
text: "SELECT * FROM user_accounts WHERE (email) values ($1)",
values: [email]
}
let user = await pool.query(userQuery)
error: syntax error at or near "values"
I forgot how to do this
If you want to find all user accounts where the email matches, you should be writing SELECT * FROM user_accounts WHERE email = $1
Make sure to check if they have sql statments or not
email = $1 is quite safe regarding sql injection
Oh
it gets parsed to the correct value
i dont used that sql much
like, that's only an issue if you do concatting
like SELECT * FROM USERS WHERE NAME = ${name}
this could allow sql injections
no
bad
$
one escaped character and u fucked
i've seen databases fall cuz of that
Most SQL libraries should already escape strings
you know what else they have?
fucking safe injection
values()

dont ${thing} in a string
'SELECT (fields) FROM table WHERE name = $1 AND city = $2',[name, city]```
use prepared statements
If itโs not a crap lib
if you read the docs*
real toxicmushroom
I am
imagine this scenario of using injection yourself
`SELECT * FROM USERS WHERE NAME = ${name}`
// input = 'test'; DELETE SCHEMA self
big brein
you are weeb
Yikes Iโm aware of what SQL injections are 
I wonder you didnโt advertise the all new detritus database engine

oh yes our little boy bobby tables
unironically if ur code is this shit, theres a good likelyhood this will pass
first cuz its shit, second im 100% sure people use admin users for their bots
with all the permissions to drop the whole database and backups
if they even make any

drop the database.. .unless you're using a more modern database engine, which lets you, say, run arbitrary external scripts on the OS.
whoooooooops there goes /root
Oh sorry did you need that /mnt thing? it's gone now.
They actually do... they also like to crash your PHP/JS code with injections if you didnโt escape the entities
Seen lots of times
redis lua scripts be like
were mining bitcoin now
(never happened to me
)
Already forgot once a time to escape user names on a panel I made
You can imagine what happened
And lets hope they cant escape sandbox
Well that disaster with escaping things just proves the world is evil.
Gonna lock my room door right now, just to be prepared!
Yes
hay
can i add the api on this code (javascript)
require("dotenv").config();
module.exports = (bot) => {
setInterval(() => {
const dbots = require('dbots');
const poster = new dbots.Poster({
clientID: bot.user.id,
apiKeys: {
discordbotlist: process.env.DBLAPI,
},
serverCount: async () => `${bot.guilds.cache.size}`,
userCount: async () =>
bot.guilds.cache.reduce((a, g) => a + g.memberCount, 0),
voiceConnections: async () => 0,
});
poster.post();
console.log (['Update discordbotlist Analytics']);
console.log('<------------------------------->',);
console.log([bot.user.username])
console.log(['Servers'], `${bot.guilds.cache.size}`);
console.log(['Gebruikers'], `${bot.users.cache.size}`);
console.log('<------------------------------->',);
}, 300000)};
yes but it would probably be easier to just use topgg-autoposter
but i can create a nieuw topgg.js
well async firebase isn't working
like it's not working as firebase it self
i can't find any methods to connect to my real time database
most databases are real time, but not all servers will utilize real-time data
I guarantee you reading the file system (for the database) will take a few milliseconds
No more โreal timeโ 
i guarantee i'll kiss ur dog if u continue with the jokes

@client.command()
async def play(ctx, arg1 = None, arg2 = None, arg3 = None, arg4 = None, arg5 = None, arg6 = None):
if arg1 == None or arg2==None or arg3 == None or arg4 == None or arg5 == None or arg6 == None:
await ctx.send("Please specify 6 players (first 3 for team 1 and the others for team 2)")
else:
match = 0
if not os.path.exists("/rldiscord/match" + str(match + 1) +".json"):
f=open("match"+str(match + 1)+".json","w+")
f.write("{}")
f.close()
match = match + 1
matchfile=json.load(open(f"match{match}.json"))
matchfile["team1"] = {"player1":arg1,"player2":arg2,"player3":arg3}
matchfile["team2"] = {"player1":arg4,"player2":arg5,"player3":arg6}
await ctx.send("Match started!")
Can anyone explain me why it doesn't work? (it doesn't set team1 and team2)
I just canโt resist sometimes...
So much unnecessary None
to show the error if you haven't set all args
You can set the argument type to its correct type to make it required (e.g. str)
wdym
not really a database, it will be deleted after like 5 minutes
sounds like something u should keep in a database with an expiry set time or in memory then
no, it will be deleted after someone stops the match
same deal
As for your issue, I'm not entirely sure, but these things stand out to me:
- You're trying to write to
match(...).jsonyet also checking for/rldiscord/match(...).json's existence (and never writing to it in that part of your program & it may be the root path of your computer directory). - You only ever write to it in that if not condition. And it won't be persistent for the next command usage since it's local to the function.
I mean everytime i tryed to install mysql or sqlite or something i had some troubles and this is a small thing so don;t need database
already tryed for the first thing and for the second there is no problem because when i delete what is inside the file I'll delete only the content inside {}
It's required if you don't set a default value. Type has nothing to do with it
So hex can just remove the default assignment
Mhm
Type is str by default in d.py anyway so explicit type hint to str might only be helpful with type checking
Dear God, just use f-strings
and some with open(...)
Exactly
How do you check matchfile
just opening it
omg i'm dumb i always forget it

Plz don't mix concats with f-strings
And use context managers. Looks prettier and less confusing
client.on('message', message => {
if (message.content === '+say') {
const args = message.content.split(' ').slice(1).join(` `);
message.channel.send(`${args}`);
message.delete();
}
});
When writing the command +say in response bot ignores me what is wrong with this command ?
you're checking if the message content is only +say
so, obviously when you pass arguments, that statement won't be true
I'd like to order. and I'd like to order a cheeseburger. are not the same
Could you please complete my code? Since I don't understand how to do it right.
if you pay me, sure
Woajjj
Are you legal yet cry
xd
I don't think xD
7 more days ๐ ๐
oh damn
My acquaintance and I have already figured out how to do it I will refuse to pay ))))
Ain't ya a special one
ะะพะถะฝะพ ะฑัะปะพ ัะฟะพะบะพะนะฝะพ ัะพะตะดะธะฝะธัั ะตะณะพ ะฟัะตะดะปะพะถะตะฝะธะต ั ัะฒะพะตะน ะฟัะพะฑะปะตะผะพะน ะบะฐะบ 2+2 ะธ ะฟะพะฝััั, ััะพ ัะตะฑะต ะฝัะถะฝะพ ะฑัะปะพ ะธัะฟะพะปัะทะพะฒะฐัั startsWith
do you know how to use replace() on a full text that i don't know? like replace a full file
A?
client.on('message', message => {
if (message.content.startsWith('+avatar')) {
embed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setDescription(`+avatar [ping]`)
.setImage(`${message.author.displayAvatarURL({ dynamic: true, size: 2048 })}`)
.setTimestamp()
}
message.channel.send(embed)
}
});
When writing the command +avatar, it gives an error what is wrong with the code?
Well what's the fucking error
Horrible to see on mobile but thereโs one } too much
Right before you gonna send your embed
im using the code if ctx.message.author.server_permissions.manage_messages: but it throws an error that manage_messages doesnt exist am i doing this right?
Anyone know any css libraries similar to tailwind css that can be used on raw html sites without the need for nodejs or react?
guild_permissions
And you might wanna refer to channel permissions instead of guild ones cuz that can be overwritten
bootstrap is a popular choice
though you'll start finding raw css less and less
react and css-in-js is getting popular for a good reason
css-in-js FTW. typestyle is pretty nice.
you don't need react for tailwind
also nobody writes raw html anymore
it's like writing assembly
but even less useful
yeah i just realized im fucking up and using the old stuff instead of the rewrite
hmm async-firebase can't connect to my database in firebase
like there is this config that contains API info so the bot can modify/read/delete the data in it
async-firebase can't access it apparently
also when i use tasks the bot doesn't respond and keep going offline (while the code is still running)
but a bot can use every emoji in discord?
no
How should I fix this?
with the new components u can use whatever emote as long as u have the id
pog
Should I contact discord about this?
while u CAN, its not like they'll do much
oof
they'll tell you to simply wait it out
it explains what to do in the message
I got over 100 servers in one day
I know, but was wondering if I could contact them instead of waiting a few weeks.
if you contact them they'll tell you to wait a few weeks
Lol
try harder
I didnt even try tho
Mine just prints images of dogs...
It is based off of a wrapper that I wrote for Dog.ceo api
I donโt think it is based on how hard you work on your bot. But more of how original your bot is. Cause making another music bot, wonโt compare to something like Groovy
oh you also posted it over here lol
damn being able to bonk the same person's ads in multiple servers
why do you have a literal type called "${bigint}"
Thats discord.js
show code
async sendLog (guildID: string, caseNum: number): Promise<void> {
const guildConfig = await this.client.db.guildDB.getGuild(guildID)
if(!guildConfig.moderation.log_channel) return
const modDoc = await this.client.db.moderationDB.getModeration(guildID, caseNum)
if (!modDoc) return
const moderator = modDoc.mod_id
? this.client.guilds.cache.get(guildID)?.members.cache.get(modDoc.mod_id)
}
you're passing bigints into cache.get?
where's the error again
Yeah exactly
what does the type definition for that cache manager look like
not the base but the one for guilds
yeah that is extremely weird
i still don't know what the type of the cache manager where you call get looks like tho
you sent the base manager
yeah
yeah no I saw
ok
Is there a type Snowflake that you can use instead of string.
Most ts libraries use Snowflake as an alias for```
${bigint}
yep
when he typed it as string it wanted it to be a string with a number inside it
for my password reset I was thinking to email them their password hash and have them go back to the app and use their email and that hash to update the password. Is this a good idea?
Generate a new hash per reset request that expires after a certain amount of time.
It is created for specific game and not the fancy "fun", "music", or any kind of over saturated bot out there. So I kinda know it will take some time to grow. Beside, not publishing it for popularity, but more of "how any further can I push with my skill" kind of stuff when I decided to publish it here
so im using speech_recognition this py lib and recognize_google as the speech type
but it doesnt recognize names
Anyone knows what reason could cause this dupe glitch?
I spam pay someone and it takes from me one time, but pays him two times.
Hmm two of the same command in code?
No..
does anyone know how to do music with discordjs/opus?
that's a very broad subject
if (!userData) {
const noArgsAccount = new MessageEmbed()
.setColor(red)
.setDescription(targetUserEconomy.replace("${user.user.username}", user.user.username))
return await message.channel.send(noArgsAccount);
} else {
userData.money += parseInt(amount);
authorData.money -= parseInt(args[1]);
userData.save().catch(err => console.log(err));
};
That's the code...
i mean with nodejs
still a broad subject
there are guides for it though
Welcome to "racing condition"
You need to guarantee that the balance object is only being modified by one task at a time
So start off by making changes to it sync not async
Can I share my code and slowly show me or else I won't progress. not spoonfeeding.
What db u use?
MongoDB.
Meh
๐
But anyway, see if mongo has something akin to optimistic locking
Actually, pessimistic locking might be better in this case
I've never used that in any of my code.. so why now?
.. now.. I guess, can it be since one of the save() is at this line and the other save() is somewhere else?
Because object modification take time
For example
Imagine a highway with 2 cars
I got you, awaiting could be the case. :)
One is red and other is blue
Red starts first, followed by blue
What car will reach first?
Red?
Yeah... things can take more than 1 second in code as well...
That's the thing, you can never guarantee sequential modification of database objects without some kind of lock
Lets say the balance instance has 1000 coins
Two tasks get it and add 5000 before saving it again
It'll end up with 6000 coins
Why not 11000? Because both see the balance as starting with 1000
Hm.. but is it similar to my case? I start with 1000, the other has 1000.. I pay 500 two times.. he ends up with 2000 and I end up with 500
Because it was you who suffered from racing condition
The target went fine, but you fell victim to it
Oh...
There are only 2 ways you can guarantee sequential updating
Using async/await on the save function, that's one?
Nope
What?
The issue can't be solved by code waiting
Because the issue begins as soon as two instances of the object exist in parallel
Oh..
For that, you can solve it either by optimistic or pessimistic locking
Optimistic uses a version property which is checked whenever the object is saved, if the version to be saved is less than the database version the it aborts so it allows only incremental saves
Pessimistic simply doesn't allow read/write until transaction finishes
Goodness...
Yeah, that's a long material to read
I never dealt with those so I'll be lost... ๐
That's something all dbms face sooner or later in life
You can try to fight it by decreasing as much as possible processing time
But you can only go so far without properly locking entities
The code I sent above is the processes it does.. 3 databases or models..
For one, try to retrieve data only when you're about to save
Like, get-add-save
Or get-remove-save
Never get-dostuff-add-save
Simply get the object again after you do the conditions
You need to remove as much distance as possible between retrieval and saving
Oh..
Also, stop using var
I need it a public variable.
There's a lot of possible delay between thpse points
We are dealing with the Data database.
you could use let instead for a public variable
Repeat the findOne just before you save it
๐
Why 2 times?
Get add save
Because the former instance is already too old
The older the instance is the more susceptible to racing condition it is
message.channel.send({embed: {
title: "Song Playing...",
color: "RANDOM",
description: `Song : ${song.name}\nDuration: ${song.formattedDuration}\nQueue: ${status(queue)}`,
thumbnail: song.thumbnail
}})```
Thumbnail is not showing
Sorry to ask.. but could you show me a code example?
.. if we're dealing with Data Database.
does song have the property of thumbnail?
try console.log(song)
before message.channel.send
and check if there's something called thumbnail
Data.findOne({ userID: user.id }, async (userData) => userData.money += parseInt(amount));
?
Then save
why do you use callbacks when you can use promise
userData.money += parseInt(amount);
await userData.save().catch(err => console.log(err));
authorData.bankLimit += 5;
authorData.money -= parseInt(args[1]);
await authorData.save().catch(err => console.log(err));
I wanted to do this but this kinda won't work...
Alright. I did.
Data.findOne({ userID: user.id }, async (userData) => userData.money += parseInt(amount));
await userData.save().catch(err => console.log(err));
That's it I guess
Regarding syntax there's little I can help since I didn't go too far into js let alone mongo
But the concept is the same
Keep distances between database transactions short or face races
.. now this won't work, right?
Author data is the author and the user data is the user I am paying.
๐
Alright. Have a great day! ๐
I'm using distube
is there any error arising?
Nope
Just thumbnail is not showing
Am I using right
Thumnail?
@clear marlin the thumbnail is in URL
the only reason thumbnail must not be showing is because thumbnail is undefined
can I do
Like : thumbnail: {
url: song.thumbnail
}
What?
gimmi a sec
yes why not
Really?
message.channel.send(new Discord.MessageEmbed()
.setTitle("Song Playing...")
.setColor("RANDOM")
.setDescription(description: `Song : ${song.name}\nDuration: ${song.formattedDuration}\nQueue: ${status(queue)}`)
.setThumbnail(song.thumbnail)
)
just another cheat code ๐
if that doesn't work surely thumbnail is undefined
Ok
Worked thnx
npnp!
anyone here using lexure?
no u
let friendbuyCheckoutCallbacks: CbCallbacksInterface = {
[SUCCESS](hostedPageId, data) {
let friendbuyData = data.friendbuy && data.friendbuy.data;
if(friendbuyData) {
window['friendbuy'] = [];
window['friendbuy'].push(['site', data.friendbuy.app_id]);
window['friendbuy'].push(['track', 'customer',
{
id: friendbuyData.customer.id,
chargebee_customer_id: friendbuyData.customer.id,
email: friendbuyData.customer.email,
first_name: friendbuyData.customer.first_name,
last_name: friendbuyData.customer.last_name
}
]);
window['friendbuy'].push(['track', 'order',
{
id: friendbuyData.subscription.id,
amount: friendbuyData.invoice && friendbuyData.invoice.amount,
email: friendbuyData.customer.email,
coupon_code: friendbuyData.coupon_code
}
]);
}
@spare fossil
-bots
no
is anyone experienced with react native here?
-bots
-bots
This user has no bots
Are you people blind
Accidental
also WSL 1.0 or 2.0?
weird, without sudo i cant ping stuff, and if i use sudo it works just fine (Debian, WSL2.0)
pinging stuff from ubuntu also works, with both non sudo and sudo
this error?
ping: socket: Operation not permitted
@ripe prairie scam ^
How can I get the id of an animated emoji and put it as a reaction?
Put a \ before the custom emoji to get it's ID. If you want to get the emoji's id programmatically then use client.emojis (if you're using discord.js, you didn't mention a lib)
i use discord.js
for example
and I put this ID between ''?
wait lemme look it up cause I actually forgot, I think you need to put the entire thing in a string
no it's only the ID
client.emoji.cache.get(emojiid)?
<Message>.react("emojiid")
I'm putting my emojis inside an array
with this will work in every server?
yeah
tysm
idk why but after the backslash it sends me the same the emojiname and not the id
wdym?
um hey
i am getting channel from mentioning it can someone tell me how can i get channel from id?
like
?send <channel id> <something>
i am using this
but i wanna mention multiple channel from their id's
const channel = message.mentions.channels.first()
currently using this
i dont know how do it
ook
so you want to have a channelid as argument?
message.mentions.channels is a collection you can loop over
just use channel.get() or channel.fetch() on the guild object
how ๐
const channel = message.guild.channels.cache.get(arugment)
this can however fail in some cases, then you need to use fetch instead of cache.get()
arugment
\:emoji: and I get :emojiname: not id
noice
escaping doesn't work on mobile
you have to put the emoji in a codeblock
I'm on computer
really?
yeah ty done
like this?
or
mybot eval /* :emoji: */ message.content
I see the id for a sec and after that i see the name
Can anyone can teach me how to make vote rewarding?
use webhooks to recive a event when someone votes
then do something with the information
I dont khow how to code / edit a webhooks
That the problem
you have to recive them
the dbl docs should work for it
if doubt look in #topgg-api
Hmm
there are the docs pinned
you shouldn't do that, pretty sure tim is a busy person and has better things to do, we can't always rely on his knowledge, we can't just expect him to always help when we need something
did you try to get the id from a unicode emoji or custom emoji?
I dont understand that code tbh
language?
Yes
this one is new, common answers are:
english
turkish
java script
java-script
java
py
python
yes yes i speak a language dummy!!
custom
then escaping it should work, if its a custom emoji you get an id, if its unicode you only get a name
so, you think that the same emoji has the same ID?
and how can I reat the message with a custom emoji?
u mean read?
if you read it as plain text then the custom emoji translates to something like <:yt_views:831613308561522708>
const owner = message.guild.owner.user.id;
owner.send("message");
channel.send("oof");
Sometimes owner isn't cached, and if it isn't.. i want to skip the owner.send().
@ HamoodiHajjiri#9923
Why are you pinging me?
(message.guild.owner || channel).send();
.. the answer is no.
oh
They are seperate messages.. like one for the owner and for the channel
How can we use that money?
Top.gg Biding Advertising.
message.guild.owner ? message.guild.owner.send() : channel.send();```
Ah.. forgot if statements.. ๐คฆโโ๏ธ
It's message.guild.owner.send, right?
both user and member has the send method
๐
it's auctions credits, not real money
you send a object without parsing it
I want to put emojis (nitro emojis) inside the message and react to messages
then
what does this mean?
parse the object to a string
and how I print them to console?
take the content of the message
and console.log it
or print
idk what u use
the approach in these cases is the same
if u use python
i can give you the code
this gives me [Object object]
actually i googled and dictionaries in js are created the same way
@stiff lynx
ty โค๏ธ
did console.logging do it?
I havent tried yet, I'll ping you after the result
ok
addField doesn't work like that
u cant pass an object
if you want to add multiple fields at once use .addFields with an array of objects
but I've already did in that way
how tf did it work lmao
Why not use a json file
addField is passing an object
{
"Bruh": "bruh"
}
It's just passing one index of addFields
the docs say the first and second parameters are strings
I've always used an object, typings also want you to use an object
a good idea
but dictionaries work too
not a big fan of json files
ps to import stuff it's literally just require("./thing.json")
I dunno python but maybe you use json.load to read json in python
*italian words
idk
should research
lol
Is there any rate limit for changing status?
i think yes
ofc
time?
we dont know tho
it sure exists for changing bot avatars
i mean status
i know u mean status
but changing anything in your bot too fast is api abuse
and can get ur bot banned
yeah that's why asking what is time limit
Is 30s is good?
i think so]
ig yeah
Ok 30s fix
uhhhh so im using discord.py and i updated my help command and deleted the other but the old help command is still sending with it
i dont know why it is
what is the old one?
the default&
Restart the bot
yeah ill reset the token and stuff see if that helps
yo
you only need to restart the bot when you make a change
not reset the whole token
and i have an offer
a smart help command
for discord.py
which is what i did
it reads the commands` docstrings
yeah its long gone
its not there
and press ctrl + s
i dont have to check the file is no longer there
a couple of times
can I give u it?
Are you hosting your bot on replit
That's your problem
yeeeees
is the problem like the file really deletn`t?
but it appears tht it was deleted?
@earnest phoenix
yeah
well heroku isnt the problem if thats the case
happens on replit all the time
all my files are stored in github
Might happen on dipshit like heroku too
how did you fix your issue then?
refresh the page
alright ill give it a try
is hosting on replit easier?
nah didnt work
than on heroku
its still doing both
the help command doesnt even exist anymore why is it sending them both?
Replit has a built in IDE so, ....
It's easier to maintain
i dont get it
ive done everything but it doesnt fix it
i use replit actually
Can anyone can teach me how to make vote rewarding?, cause i dont understand how to setup it
fuck it ill try token
use Webhook
That the problem
correction: replit is an ide
I dont understand it in #topgg-api
I dont khow how to make it tbh
..
Can anyone teach me..
well in their homepage they say "hosting"
no
ikr





