#development
1 messages · Page 1703 of 1
It only updates if it has that intent, it updates on connecting to the gateway and receiving a guild payload if it doesn't have it
Ecks dee
ye
guild delete sends an entirw guils object?
so unless you recieved an event with an updated count, or your lib adds them dynamically based on your events, you wont get an accurate count
i think it might feud
let me check
I doubt it
I think it doesn;'t
GUILD_DELETE only returns { id: string, unavailable: boolean }
hey feud you once said you can use discord api with an http server instead of weebsocket
i cant find any docs on that

slash commands
It should be in the slash commands section
no ws required for slash commands
slash commands work via webhooks

ight
might think bout adding that in v0.2.0
because ive spent too long on this bs
yeah its only GUILD_CREATE as far as i can tell that includes the member_count with the payload
so it wouldnt update until a guild is unavailable
getting an invite by rest gives an approximate_member_count which is good enough tbh
whiuch would trigger another GUILD_CREATE payload when it comes back online
though making invites/fetching invites could potentially be bad too
yeah
why do we need to get a gateway url from discord.com/api/v8/gateway even tho it's the same url everytime
im always wary of bots making invites
because it may change at any time
it's changed before when Discord changed their domain
although that already required a base url change for libs anyways
that too
its also possible that discord might have thought about load balancing it across geolocations but just never implemented it
the same way it returns v8 now, it returned v7, v6, v5...
basically keeping you up to date with the gateway versions
but that's basically useless because if you go up a gateway version something is granted to break
good point
its 7, yeah
its like windows 9
v8 is funny js number
sevenatenine
wasn't it because internally it was all a mess
Funny JS engine number
guild_subscriptions moment
funfact
and it got fucked up with adding the games thing and removing it a few months later
i actually got some unique errors
v8 > w8 > wait > await
yeah v7 is basically a more descriptive v6
i managed to get 500's from discord
You got a rare screenshot
indeed

predecessor to intents. It was a step in the right direction, but it's deprecated now
rate
That happened many times
shush
rare
typo
it happens every week
u mean slash
remember when quarantine first started and discord was not ready for that big of an influx
I have seen that exact error in discord.js support server like 500 times
so the api kept going down every other day

ShitServerException
I’m api banned from my welcome message so when they view my bot it will be offline
PogYou
Gotta love how discord API throws an internal server error if you didn't send an object payload when banning someone
hmm yes, very good
lmao
fun fact
I didn't know DELETE /guilds/:guild_id/members/:id required a body
the gateway is so fucked and messed up that user tokens now have 2 ready events! one is READY and the other is READY_SUPPLEMENTAL that fills objects sent in READY
wat
What the fuck
since when
-> reason
-> purge duration
-> some other shit
Oh. payload_json basically
why?
this is totally not my own screenshot
Bruh
Guess it's just to fuck with client mods or other client implementations
butt
yes
the client uses v8
but the api doesnt have that
Pretty sure they said not all official clients use v8 yet
even in v8
yeah
so its an app only thing
it's a user-exclusive event
Imagine if the client used v6 when they recommended v8
Wouldn't be surprised
it makes sense tho
the client used v8 wayyyyyyyy before v8 was even publicly out
They delayed forced v6 deprecation because not all official clients updated
because of video streaming
didnt cry tell you like, 10m ago?
no one has helped you, please stop spamming that @mellow kayak
You asked that like 15 times now
i didn't, but yeah someone did
Kuuhaku did
@mellow kayak ^^
you already got told what and why, if you don't understand what that code snippet does, take a step back and learn python first
ok
i'm not lol
Man, centering text inside a rectangle in canvas is so much pain
just {text-align: center} bruh
I tried using sharp to replace jimp and loading custom fonts was virtually impossible

in keyword should allow for that
I need to switch to a native dep at some point, because jimp kinda sucks
but thats py, not js, so its not my area
you welcome, i guess?
well time for booze for pain supressing!

actually
i cant
meds
fuck
frick
fork
frock
frak this.

fek
How do I get rich precense on Replit
👀
??
That depends on the lib and client you're using not the host.
i use replit
That's a host not a lib
bots accounts cant have rich presences
i want one!!!
Look at Discord's docs for the Game SDK or try and find some software that gives you options for one to run on your own computer
i use replit
Yeah bots can't have rich presences but you can have one on your own account (see my profile)
the software that integrates with Discord's Game SDK has to be on the same machine as the Discord you're logged into with. So, it has to be on your PC
i want one
how would you detect if a text starts with an emoji (browser/plain js, not nodejs)
oh
i dont have one
i have a macbook pro
adopted kids
for custom emojis, there's a regex you can use. For built in emojis, you'll need to use twemoji's regex
and 8gb vram
Rejex search on the first word of the message?
not discord bots, i mean plain js
yes
how do u have rich preceinse
???
the same methods apply

whats the regex i suck at regex
Run a process on your computer. I also use a macbook pro.
look it up
i cant host 24/7
if you're not gonna be on 24/7, then there's no need to host something 24/7
ok gtg
It's a separate process to your bot. Rich presence is a totally different thing. My bot is on a VPS. This rich presence is just a single file of code that runs on node in my terminal on my laptop.
@strong oak DM me. I'll send you the file when I get a chance
screams at google
Split your string into an array of individual words and check the first element of the array against a rejex search.
yah im doing stuff with
/(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])/gi
but im trying to do a startsWith instead
I'd probably split the string into an array and check the first element
startsWith takes a string? Not a regex
in the expression, you can put a ^ before the (\u00a9
/^(\w+) ?/ matches the first word of a sentence because of the ^
/(\w+)$/ matches the last word of a sentence because of the $
they were trying to match emojis (custom and unicode) and string.startsWith would not be sufficient
I'm aware, but it sounded like they said they were supplying startsWith with a regex
ah
you must have how many GB minimum for a music / radio bot ?
figured i cant do that because it wouldnt be per space but it would be per character then stuf break
too many factors to tell you a fixed number, it all depends on your usage, influx, where you're streaming from, what you're streaming, with what you're streaming, what library you're using..
best is to run benchmarks locally
and calculate an approximation
I manage over 3.5K guilds with roughly 1GB
closer towards 4k
It's not recommended to actively seek out and make a music bot, though because it's too competitive and requires very frequent maintenance
YouTube banning IPs if they request "too much" also doesn't help
x/
i recently installed java on my pc and im trying to run a java file but it says javac is not recognized blah blah
the main command is just java
so how do i run a java file?
also, with a lot of jdk distributions you need to add it to your PATH
yeah i tried that
i followed most of these answers
if java is indeed added to your path, you would just do java -jar file.jar where you replace file.jar with the file name
let regex = /[\u{1f300}-\u{1f5ff}\u{1f900}-\u{1f9ff}\u{1f600}-\u{1f64f}\u{1f680}-\u{1f6ff}\u{2600}-\u{26ff}\u{2700}-\u{27bf}\u{1f1e6}-\u{1f1ff}\u{1f191}-\u{1f251}\u{1f004}\u{1f0cf}\u{1f170}-\u{1f171}\u{1f17e}-\u{1f17f}\u{1f18e}\u{3030}\u{2b50}\u{2b55}\u{2934}-\u{2935}\u{2b05}-\u{2b07}\u{2b1b}-\u{2b1c}\u{3297}\u{3299}\u{303d}\u{00a9}\u{00ae}\u{2122}\u{23f3}\u{24c2}\u{23e9}-\u{23ef}\u{25b6}\u{23f8}-\u{23fa}\u{200d}]*/ug;
I hate regex ok kthx google cya
protip
download the json file, parse it locally, boom
minified version at https://static.emzi0767.com/misc/discordEmojiMap.min.json
Regex is fun. I made a way to have native relative path resolution from node_modules exported functions using Error stack frames and regex
oh no still not working
ok ill try
Lol no
tetris wouldn't work in Discord. Text based games come far and few
at 1 fps!
per channel!
Technically 5FPS but only if you want to risk being banned for rate limits
Catching pokemon
Not i know just saying some one will make cool tetris game in discord bot that be neat
Go do it yourself then.
i dont think im smart enough to be coding
Ah well that's a shame then, no one's going to make this super awesome cool bot that's impossible but you, the layman, thinks can be done.
We must not be smart enough either to know how.
If someone good at coding they will some are smart.
Hola
i think im slighty less than average at coding
The problem isn't: "no one is smart enough to do it"
The problem is: "It's impractical. It can be done, but it won't be user friendly at all"
maybe alot
Exactly, Ophidian
It would be utter shit
So no one smart enough to do it is dumb enough to do it.
how are yall on this fine monday
waiting for Discord to actually allow bots to seem native like a mockup they showed when they announced verification
my server is still stuck in verification 😭
Why
because theres a backlog
never™️
Its asking you put a number?
true™️
@outer zenith
or if they do manage to implement it, it won't live up to its expectations
just like slash commands
what?
verification
Oh
custom html would be cool. If they could at least sandbox it, have devs create their own UIs
not likely
Flash player is dead rip
but a guy can dream
Love new html 5
"new"
Like you playing a duelingbook website
huh?
whats that
They use to have flash player not no more
they can't even implement proper embed control 

there's a way to kind of "fake" custom UI elements
make your UI element an image, split it into custom emojis
hyperlink it in an embed description
this works on desktop
Java not bad for playing runescape
this embed used to extend further, but the bar would take multiple lines on mobile. Now it just fits
A little bit more painful for desktop users, but the experience is uniform across platforms
that inconsistency in spacing is what made me just transfer all of my stats commands and stuff to image generation on my old bot
sure the performance suffered a bit
but it was worth it
Might do that myself tbh, although the problem then becomes asset crunching for people on slower connections
Also, if you have to edit the message. Pain ensues
good point
there's a way to also cicrumvent that, kind of? it's nasty but it works; upload the image elsewhere, return the attachment url, set it as embed image url
yeah. That's what I did when I tried to make a game of sorts and have custom UI, but it sucked so badly. Clean up was also a chore and just bleh
dude, you drunk?
...it's the first time I said
it's just that you've been there for about 30 min saying random things about flash and stuff
damn, it's crazy how much discord depends on bots to keep its platform interesting and live and yet they give a big fuck you to bot developers lol
sorry, not all bot developers
if you're mee6 or groovy, we love you
the rest can go fuck yourselves
naur bc remember the bots tab in the guild settings?
they didn't have plans to make it dynamic
a static list of 4 bots
2 of which were from discord employees
and the 2 others were mee6 and groovy
favouritism at its finest
they don't care about bot developers
I heard microsoft bought discord
I saw google news
boogle news
imagine not getting your news from techquickie
They haven't been bought yet because Discord is not profitable at all
plus if ms bought discord it would be mega awkward
3 apps that have the same goal
skype, teams, discord
I allow post link?
Ign news
like my hosting service sadge
Ign never lie
could
bro are you blind
not that they have
I know what they say could
Microsoft rich
And Amazon
Nintendo rich as well.
Because people buy nintendo switch
guild id, userid, channel id, usernames, guild names, channel names etc
AHH ok
and the question "WHAT SYSTEMS AND INFRASTRUCTURE DO YOU USE?"
is if I do Js python ect ..?
you don't have to shout :(
but yes and no
describe your infrastructure
what library your bot is using, where it's hosted etc.
things like that
thanks x)
I still have these 2 questions
"DOES YOUR APPLICATION UTILIZE OTHER THIRD-PARTY AUTH SERVICES OR CONNECTIONS? IF SO, WHICH, AND WHY?"
"WHAT IS THE PROCESS FOR USERS TO REQUEST DELETION OF THEIR DATA?"
sorry to bother you but I'm not very good in English x/
right click + translate page
How does a bot retain from cache refresh? Ok i know that seems odd but iv seen emoji bots change their names to the user including avatar and post a message to only revert back and it stays.
that's a webhook
even with the translation I didn't really understand very well
it's the one that I didn't understand
"DOES YOUR APPLICATION UTILIZE OTHER THIRD-PARTY AUTH SERVICES OR CONNECTIONS? IF SO, WHICH, AND WHY?"
@vivid fulcrum appreciated the reponse, can you expand at all?
does anyone know how to make a discord bot in .net 5 C#?
if so, can you help me? or direct me to the docs
thanks
ha just on that
related info: webhooks can change their username and avatar on any message creation
the discord client shows the webhook as a bot but it isn't actually a bot... or a user in the first place
appreciated. reading that part. would have never know its a webhook
if you look carefully, you'll see that webhooks have no hashtag part that normal users do
and you can't message them
hopefully can migrate this into dsharpplus
oh yeah dsp has full support for webhooks
not even looked into their webhook classes
wicked
cry one last quick silly question. with most things in programming you have a structure. can in send one request with name change, avatrt at once, or does every request have to be single
can i *
you can do everything in a single request
coz i often get ratelimit which no one wants
@vivid fulcrum u got any docs on C# .net 5 discord bot?
does it?
like, you're supposed to understando what that means by now
that said, I really think discord verification should be about 500 servers or so
75 is too little to grasp the concepts about such stuff
how do i get my bot to prompt if a user enters a command thats not registered (Hey User you have tried to use a invalid command), i tried google but got "how to blacklist someone from using commands with quick.db"
oh
if your user attempted to use an unknown command just don't respond
the user will know that the command doesn't exist because there's no feedback
and you save yourself a request, preventing a ratelimit in the long run
i do have one problem, been a problem ive overlooked when my unban command is used it unbans but doesnt send the unban message
Unban message?
this is what it looks like, the unban message never triggers
exports.run = async (client, message, args) => {
if (command.guildOnly && message.channel.type === 'dm') {
return message.reply('I can\'t execute that command inside DMs!');
}
if (message.member.hasPermission('ADMINISTRATOR')) {
return message.channel.send(`**${message.author.username}**, You do not have permissions to unban someone`)
}
if(message.guild.me.hasPermission("BAN_MEMBERS")) {
return message.channel.send(`**${message.author.username}**, I do not have permissions to unban someone`)
}
let userID = args[0]
message.guild.fetchBans().then(bans=> {
if(bans.size == 0) return
let bUser = bans.find(b => b.user.id == userID)
if(!bUser) return
message.guild.members.unban(bUser.user)
if(unban)
return message.channel.send(`**${message.author.username}**, I have unbanned the target user`)
})
};
exports.conf = {
enabled: true,
guildOnly: true
};
if(unban) but you don't have a variable named unban anywhere?
What is unban defined as 
its never error'd on me when used,
Is it even triggered, lol
nope lmao, i think that bit is cornered off somehow
unban is this section message.guild.members.unban im calling the wrong section o-o
because it never gets to that point anyways
you return the unban promise
but now thinking of it if i just remove the if(unban) return it should catch onto the section above right?
if(!bUser) this also seems incorrect
if it's not defined, unban
you're supposed to check if it's defined, unban
if(bUser)
{
try {
await unban;
return send();
}
catch {
//god knows what happened here
return send();
}
}
//bUser not defined here, user probably not banned?
Would y'all suggest using Windows or Linux to host your bot? I'm more used to Windows, never used Linux but it's cheaper
K, thanks
what a fucking update
eevne
d
here we go sorting out over 500 errors
nice one
I use Linux to host all my bots
The only time I'll ever use Windows to host a bot is when I'm temporarily testing while adding more features or commands on my PC
That's a thing I hate about JS
It's too complacent
That IF won't error because non-defined variables are falsey
How to log who used command in js
Nah, the non-defined variable would error.
When a message is triggered and the message was a command, log it
Store in a database
Or if you don't want long term storage, just console.log it
I'll send in log channel insted
console.log(${message.author.name} just used example command)
I hope you don't mean "log ALL command usages"
Cuz you'd kill your bot quite quickly that way
how?
I wanted to log only one command
Still
I recommend you avoid using Discord as a logging service.
So which should I use?
Remember, you're not dealing with 10 or 100 users
Hmm 🧐
You could use a local file or some online service that specializes for logging (or just has good stuff for that)
You're dealing with tens of thousands or even hundred of thousands of potential users
Right
Imagine if all use the command at the same time
Can i have a channel for logging errors
is their bot small
yes
Don't please, but logging in-server errors is fine
You can use a channel for logging errors, but I personally recommend you don't
What starts in a server ends in that server
Small bot YET
try going for 0 errors a month
Couldnt be me
This could be you!
Simply deleting a bot message after sending it results in an error when it's only deleted once
what bot are you running lmao
My twisted logic lol
lmao
Need to fix it 😭
If it's a bad idea why even try it?
my server staff would like to be able to see errors
Again, if it's per-server error logging it's fine, but don't try to make it N-to-one
Lol
Check if a message exists before using the object
@tacit sequoia can you send me the code i cant find anything online for it
Dont
can you not
It's just using discord.js webhook client
ahh
You can't spoonfeed, that's why I said "dont"
Didnt spoon feed
Sadly that wouldnt work unless I fetched the message from the message object to check if it still exists. Since even if I deleted a message it will still stay in the message variable
Probably something I did wrong anyway which has some simple fix I havent though of
You could also .catch it
And tell it not to throw an error? Wouldnt that be really messy
Honestly, "unknown message" errors are as useful as dry hay
Log them at debug level if you must
Yeah
Hello, I do not send the Vote Message that I Set to the Value I Registered in the DataBase in the @ top-gg/sdk Module. So how do I set it?
Sorry, I'm Using Translator Maybe Wrong
AccitroClient.on('typingStart', async (Next, EndChannel, EndUser) => {
if (EndChannel.type !== 'dm') return Next(true)
const End = this.ADMClient.Users[EndUser.id]
if (!(End && End.OtherEnd)) return Next(true)
const OtherEnd = End.OtherEnd
const OtherEndChannel = OtherEnd.DiscordUser.dmChannel || await OtherEnd.DiscordUser.createDM().catch()
if (OtherEndChannel) {
await OtherEndChannel.startTyping().catch(() => {})
await Sleep(5000)
await OtherEndChannel.stopTyping()
};
Next(false)
})
my bot won't stop typing
i waited about 30s
a minute has passed still typing
there's no typingStop event either
My ban command wont work its showing a syntax error (discord.py)
@client.command(aliases = ["b"]) @commands.has_permissions(ban_members = True) async def ban(ctx,member : discord.Member,*,reason = "No Reason Provided"): await ctx.send(member.name + "Has been banned") await member.ban(reason = reason)
nevermind, i don't have to await for it.
hey
pls @vast garnet
What's your main language?
turkey @lyric mountain

Turkey, Turkish ?
Show your code around that command as well
And send the traceback
hi
i'm new at webhooks and need a little help
do i run both the webhook and server together or are they separate
Hello, I do not send the Vote Message that I Set to the Value I Registered in the DataBase in the @top-gg/sdk Module. So how do I set it?
Sorry, I'm Using Translator Maybe Wrong
how do I add a cooldown blacklist?
for example if a person spams a command cooldown for too long he will get blacklisted for 1 hour
Well, if you using javascript. You can use map or set or much better discordjs collection
Pls
@dry sapphire why u left me?
Quick question about sharding. When it comes time to need to spawn a new shard, do I have to restart my bot for it to spawn or will djs do it automatically?
The only times I've noticed it created a new shard is when I've restarted it in the past.
I was just wondering if I left it alone would it handle the new shard creation by itself.
I still dont know what shard does lol
Then please don't ping me lol
I have mine set to "auto" and it creates the recommended amount of shards for me, but when I restart the amount can lower or go higher depending on the server change
So yeah you pretty much gotta restart the bot I guess
I was stuck at 8 shards for a while and then restarted and it went to 11
Yeah I've got the same settings and noticed the same thing. I guess having a shard that's "too full" isn't so bad then.
Yeah. I only restart nowadays if it’s a new feature being added or bug fix
I noticed it’s about 1 shard per 1k servers and it doesn’t seem to give any issues of being overloaded or anything
Same here that's why I was wondering. Wasn't sure if shards getting too full was going to be a problem.
I noticed auto typically allows for shards between 955 and 1,100 servers each
anyone wanna be a dev with my bot?
ask somewhere else
Oh ok....
I need my bot to send a reply if I use !cd with I'll remind you in 1m.. Then, after 1 minute, it replies with your cooldown is over..
okay, and?
that's it
What is your language?
.py
Cant help then, if it jajvascript can use map/set
how?
Who can help me with bdfd?
Idk python is the best and the only answer I can give you
true
we all love the snake
Is there a api wrapper for discord servers in python?
"for discord servers" do you mean for bots?
i think webhooks work for servers
we only have dsl roles
scarpe it
I m sure they have some limitations over scraping
Thanks
hey does anyone know the parameter to fetch the yt thumbnail with yt-search?
Does the Discord User ID have the same number of digits?
Nope
What library does it use? (Rich presence)
have i done something wrong? because it doesnt seem to be working
hey does anyone know the string for thumbnail in ytdl core
long description is not body
where else am i meant to put it?
use the dev tools to see what classes are on the description
How to send message to another channel from eval?
get the channel and send
your bots ip address or hosting url
@quartz kindle how to get hosting url ?
Is it correct
ids are strings not numbers
where is your bot hosted?
@quartz kindle heroku
then your url is yourappname.herokuapp.com
and your webhook port must be set to 3000
client.channel.get("831453092766941206").send("Test")
Now??
what would i do if mine is hosted on aws? @quartz kindle
o
get your instance's ip address
public or private?
public
ok ty
const Topgg = require("@top-gg/sdk");
const express = require("express");
const bot = new Discord.Client();
const topgg = new Topgg.Api("topgg-bot-token");
const webhook = new Topgg.Webhook("topgg1234");
const app = express();
bot.on("ready", () => {
console.log("ready")
})
app.get("/", (req, res) => {
res.send("pinging");
});
// const ap = AutoPoster('topgg-bot-token', bot); // your discord.js or eris client
bot.on("message", async(message) => {
if(message.content.startsWith("!test")) {
let voted = await topgg.hasVoted(message.author.id)
if(!voted) {
return message.channel.send("You have not voted me")
}
else{
return message.channel.send("You have Voted Me")
}
}
})
app.post("/dblwebhook", webhook.middleware(), (req, res) => {
// req.vote will be your vote object, e.g
console.log(req.vote.username); // 395526710101278721 < user who voted
client.cache.channels.get("820659008620593213").send("req.vote.username just voted me.")
});
app.listen(3000);
bot.login("bot-token")```
@quartz kindle will this work on test vote?
shojld work
you have to add /dblwebhook to your url
Ok and i have dn in webhook url = https://Vote-Test.glitcheditz16.repl.co
webhook auth = topgg1234
@quartz kindle is this correct
where to add /dblwebhook
end of url
Ok after .co/
yes
For repl it its https://something.me.repl.co/dblwebhook?
so for the webhook thing if im using aws do i put it like this IP:PORT/dblwebhook?
should be yes
Ok Ty
yes
Iam want to give rewards.Is it
db.add(`balance.${req.vote.user}.wallet`, 5000)?
Hi Tim
console.log req.vote.user and see if the value is correct for your database
@quartz kindle how to get username instead of id i tried req.vote.username but undefined came
console.log req.vote
and see if there is a username there
if not, you have to fetch the user
I think it should be req.vote.user.username?
vote.user is an id, so no
this return
bot: '819523401207119872',
user: '730705582683586621',
type: 'test',
query: [Object: null prototype] { test: 'data', notRandomNumber: '8' },
isWeekend: false
}```
@quartz kindle
Bro i just realized we are in an incorrect channel.
We need to move on to #topgg-api
There no one was replying so i came here
you need to fetch the user
@quartz kindle how pls tell like this?
bot.members.cache.get?
Also you should probably fetch it, it's not guaranteed that's in the cache
...
await bot.users.fetch(req.vote.user)
ok
Are you though...
Bro come to #general-int i wanna ask you something
How to write out the server region?
With javascript
thx
d
exports.run = (client, message,args) => {
const Discord= require("discord.js");
const e=new Discord.Guild(client, data);
const server=e.region;
message.channeé.send(server);
}
data is not defined
:/
Yes it’s not
What are you trying to create a new guild like that
like why the heck
you can get the guild from message.guild
wtf
oh
he saw the docs page for the guild object
and the top of the page has a guild constructor
he copied that lmao
Lol
yes xd
learnjs moment
I am too idiot im just copy paste
@-@
Are you actually dumb, as in, lacking the mental fortitude to code, or are you just lacking the experience and knowledge to understand the code?
Because if you're actually just dumb, the only help we can provide in terms of bot coding is "don't code bots, use those that exist".
if you're just lacking experience, then there's a solution and it's "just take the time to learn javascript and you'll be fine".
Most people that say or think they're dumb, it's just because they're rushing into thinks head first and being overwhelmed by a lot of information all at once. Anyone would be!
I learned javascript bruh
lol
Oop
You can tell yourself that all you want, the above conversation seem to say otherwise.
Um
Hello, I do not send the Vote Message that I Set to the Value I Registered in the DataBase in the @top-gg/sdk Module. So how do I set it?
Sorry, I'm Using Translator Maybe Wrong
yes, it looks wrong, i dont understand the problem
hm
i hate myself now
and this visual studio code too
Be confident and don't give up👍
if you know js then its not that hard
first of all you have to start with what you have
what do you have?
a message object
so start there, go to the docs, look what a message object has
and continue from there
BRUH
const region= message.guild.region;
message.channel.send("A "+region);
ok i solved it :v
yes good job :)
HTTPError [FetchError]: request to https://discord.com/api/v7/gateway/bot failed, reason: connect ENETUNREACH - Local (0.0.0.0:0)
at RequestHandler.execute (/root/bot/node_modules/discord.js/src/rest/RequestHandler.js:93:15)
at processTicksAndRejections (internal/process/task_queues.js:97:5) {
code: 500,
method: 'get',
path: '/gateway/bot'
}
```what happened here?
hm
discord having a stroke
that error means your internet dieded
at RequestHandler.execute (/root/bot/node_modules/discord.js/src/rest/RequestHandler.js:93:15)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
I have a question
How to translate to hungarian word?
There aren’t that many, do it manually and use a map
what map?
const region= message.guild.region;
if(region=="europe"){
message.channel.send("Régió az európa");
an object keyed with the regions
an object is easier
Well now that you know if statements, you should learn objects
Not really ish
aah
Like almost all bots shoe like perfectly accurate member count
mine says 20k
For a 55k server
now that's huge diff
Not all members are cached
^
reduce each guild to get all memberCount
Use a for loop(or a foreach) for each guild and add up a member var from there if you really need it using amount of members
Ok
Bruh u literally have message.channel.id
it would delete teh channel where the message was sent
So change ut
it
message.mentions.channels this?
Ya

yes.delete() no?
idk
Yes
well try it
Ok
bruh
it isn't?
it is
isn't
is
look, the issue is that you're literally lost
it's a simple collection problem
the issue is that you're doing this: message.channel.delete(yes);
lemme read that for you
"Execute delete function in the channel object from the message object"
which can be humanized to "Delete the channel the message was sent in"
did you just delete your messages?
or you can just say that the delete function is bound to message.channel, which is the channel the command message was sent it
that's why you need to get the mentioned channel
typical behavior
did you even understand the problem or just copied the answer?
you didn't even put yes.delete(); in the first place
i did in visual studio code
wot
without this ()
for javascript?
do you know basic javascript?
yes
that's a lie
sometime i forgot to add () lol
you don't know basic javascript
i know javacript i don't know discord.js
that isn't a d.js issue
Sigh... anyways
I have this array with elements, and each element has a weight and an amount. I'm looking for an efficient way to get N random elements from the array, taking into account the weight and the amount, if an element has an amount of 0 it shouldn't ever be returned by the function
filter then randomly select from the filtered array?
i don't know what would be more efficient
that or re-running rand until you get an element that has > 0 amount
ideally you would cache the filtered array
probably the random method is the most efficient
weighted random aint so easy
another way of solving that would be to create weight copies of the object and put in a list
then shuffle and get a random element
or join all weights together and math.random a number out of the combined weight
and find the item with the matching number
^ that's what I'm doing
but combining both weighted and with an amount is kinda hard
for amount it's fairly easy tho
.filter it
anything with amount <= 0 should be filtered out
i seriously thought this would work;
exports.run = async (message) => {
if (!message.member.hasPermission("ADMINISTRATOR")) {
return message.channel.send(
"Sorry but you do not have permission to Delete Channels"
);
}
message.react(":firecracker:")
await message.channel.delete()
}
err
TypeError: Cannot read property 'hasPermission' of undefined
i did console.log(message) it didnt do anything when i used the command i might of missed it when it starts up tho
I thought Message.member was nullable only
oh my go
they might have client as their first param without realizing
why
filter, map and other similar methods return an instance of the class that is extending the Array class, not an instance of an array, and I'm storing some properties on the class, which are undefined when created by the methods
i cant go through my console it capped off after loading command kill i cant go further back to find the command @_@
hi
You can override the methods to return Arrays
or proper return values of extensions of the class
Log to a file or something
better off just storing the array as a property of the class tbh
instead of extending the class
Then you'd have to implement most or all of Array's methods
the class isn't really meant to be used like an array though
ive tried fs.WriteFileSync in the past and it failed to log the command i tried logging
Try harder
try harder better faster stronger
Or look for some library that can do it for you
if youre running your bot on windows you can configure the size of the console buffer
so you can uncap it
F to Daft Punk
i added the fiile write it didnt write, nothing ever wants to work for me -_-
Try, fail, retry, keep repeating step 2-3, succeed
error maximum stack size exceeded
is this done right?
const fs = require('fs');
const path = require('path');
exports.run = async (message) => {
console.log(message)
if (!message.member.hasPermission("ADMINISTRATOR")) {
return message.channel.send(
"Sorry but you do not have permission to Delete Channels"
);
}
message.react(":firecracker:")
await message.channel.delete()
fs.writeFileSync(path.resolve(__dirname, '../log/log.json'), JSON.stringify(message));
}
:^)
Set stack size to -1
yayyyy got voice connection working in my lib 😄 now just gotta actually send some voice data!
nice
Thoughts on what can be improved?
voice is so annoying
true
Yo, real quick, how do i check if a message is sent from a specific user (id)
discord.js
I Have it set per role and its annoying to always make a custom role 😭
message.author.id will give you the id of the user who sent the message
if (message.author.id == id) Would this work?
yeah
Ty
i got the log to work... well it just logged everything in the guild... but not in the file it logged it on the console
ok
await ctx.channel.send(f"{ctx.author.mention}, your cooldown is over!")```
I want use own emoji after over! . how?
Can i somehow surpress these errors?
catch them
How
I Dont even know from where the errors come from :e
Our previous dev coded the bot
he got demoted shortly after
it tells you though
literally it tells you the lines, index.js line 321 , index.js line 342...
how i get a list of all members in all servers my bot is in
loop through every guild -> fetch all members from guild -> access your member cache
why would you need a list of all members? how would that be useful?
to increase their memory usage ofc
obviously
how to track votes
Using the #topgg-api works fine
Which permissions does a bot need for its auto role to send messages?
I have ticked:
SEND_MESSAGES
MANAGE_MESSAGES
READ_MESSAGE_HISTORY
VIEW_CHANNEL
but when I try to enter a command the bot says
UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
the role the bot creates when it joins a server
Well you'll need MANAGE_ROLES, obviously
Hi I'm using discord.net and this piece of code works only if bot has actual administrator privileges
foreach (SocketTextChannel channel in channels)
{
await channel.ModifyAsync(c =>
{
c.SlowModeInterval = interval;
});
await Task.Delay(250);
}
```Am I doing something wrong? Or it really require admin privileges?
oh really?
... yes... to give roles you need manage roles...
yeah obviously tho 🤦♂️
but I still get the message with DiscordAPIError: Missing Permissions
how to use more than one member in a command discord.py
I'm using this code
if(message.member.highestRole.comparePositionTo(message.mentions.members.first().highestRole) > 0){
//member has higher role then first mentioned member
if(member.kickable){ //Just in case
message.mentions.members.first().kick();
}
}else{
message.reply("You can't kick your senpai °^°");
}
Now I shouldn't be able to kick some higher ups
But I can kick anyone with higher role than me but when I try to kick Someone lower than me It doesn't do anything (no console no message nothing)
now what is wrong with this code
@median rain you can make a bot work with pure Py but you will not have features like embed ect
Hm ok
Unless you code your own library which is kinda pointless when DPY is there lol
Yeah
db.delete (para_$(msg.author.id), 1)
Why is all the money going?
wrote the module completely manual
what is? entire?
but its kind of proprietary code im gonna use in future projects
the drawing module
i have a clock drawing module less then 100 lines 😛
js
if u can u could port the clock module? 😛
for your own ofc
this is how my charts look like
thats pretty neat
how did u do the colors ?
i had to utilize the hsl2rgb
to get what i wanted
had to write those myself
Public Shared Function GetRaindowBrushes(limit As Integer) As SolidBrush()
Dim v As Double = 0, inc As Double = 0.01, i As Integer = 0, result As New List(Of SolidBrush)
If (limit > 0) Then inc = 1 / limit
While v < 1 And i < limit
result.Add(New SolidBrush(Colors.Hsl2Rgb(v, 0.5, 0.5).ToColor))
v += inc
i += 1
End While
Return result.ToArray
End Function
cool
not hard
the db design was a bitch tho
made a mistake in the base, had to change it later on
not wanted to loose the data
hey
and a custom comparer, coz dotnet uses a Hashcode from the object that doesnt work with getting the right distinction between users
i don't quite get this:
modulus
how can 13 \ 4 equal 1?
it tells you what it does





