#development
1 messages ยท Page 1360 of 1
Yup
Also used to print a backslash, '\\'
My bot is logging no error
client.on('guildMemberAdd', async(member) => {
const guild = member.guild
const wlcm = db.get(`WLCMCHANNEL_${guild.id}`)
if(wlcm == null || wlcm == undefined || !wlcm) return
const wlcmfinal = msg.guild.channels.cache.get(wlcm)
const card = new canvacord.Welcomer()
.setUsername(member.username)
.setDiscriminator(member.discriminator)
.setGuildName(guild.name);
card.build().then(data => {
let attachment = new Discord.MessageAttachment(data, "test.png");
wlcmfinal.send(attachment)
})
})```
My Code
const wlcmfinal = msg.guild.channels.cache.get(wlcm)
replace msg to member
member.user.username, same goes to discriminator @delicate shore
also, just use if (!wlcm) return;
both works
you defined guild as member.guild
honestly, that's redundant, avoid creating variables like that
just straight up use member.guild
oh k
Error: Cannot find module 'snekfetch'
npm install modulename
what
js
i ahve
Go learn JS
lol
Then NodeJS
npm i snekfetch
npm i node-fetch

npm uninstall npm
How to stop countdown when someone send message 'stop'?
here my code
client.on('message', async message => {
if(message.content === 'start') {
let countdown = 10
var time = await message.channel.send(`${countdown}s`)
function starttimer() {
if(message.content === 'stop') {
clearInterval(timer)
} else {
countdown = countdown - 1;
time.edit(`${countdown}s`)
}
}
var timer = setInterval(function () {starttimer();}, 1000)
}
})
what i do
@neon heart you don't need a function for the setInterval you can just use setInterval directly without creating a function and then use clearInterval(this) instead
I hope you understand what I mean
ok wait
throw err;
^
Error: Cannot find module 'snekfetch'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:548:15)
at Function.Module._load (internal/modules/cjs/loader.js:475:25)
at Module.require (internal/modules/cjs/loader.js:598:17)
at require (internal/modules/cjs/helpers.js:11:18)
at Object.<anonymous> (/rbd/pnpm-volume/8cbb5981-f02b-460a-8ccd-c240567c484b/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/util/Util.js:1:81)
at Module._compile (internal/modules/cjs/loader.js:654:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
at Module.load (internal/modules/cjs/loader.js:566:32)
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
at Function.Module._load (internal/modules/cjs/loader.js:498:3)```
Can someone tell what's the meaning of payload
D:\among us emojis\node_modules\discord-player\src\Player.js:608
}, this.options.leaveOnEmptyCooldown ?? 0)
^
SyntaxError: Unexpected token '?'
i cant find that
why are there two ?
it should only be one
i can't find that
the file path is also there mate
@tardy hornet to use ?? You need node 14
@tardy hornet imagine sending where? in line 608? it's not there and then deleting the message probably cuz you realize it's actually there
smh
O
"711900803232956478": {
"guildId": "711900803232956478",
"guildChannel": "741721773959020629",
"guildNum": 1102,
"totalCount": 1149,
"lastMem": "737611247989686333"
},
"669175474798198824": {
"guildId": "669175474798198824",
"guildChannel": "767650943717998622",
"guildNum": 262,
"totalCount": 11,
"lastMem": "610955741830053894"
},
"749492313104842835": {
"guildId": "749492313104842835",
"guildChannel": "768084884165492756",
"guildNum": 37,
"totalCount": 8,
"lastMem": "763087229920083968"
}
}
I have a this json database i create a code to get me higher totalCount
let serverData = JSON.parse(fs.readFileSync("./serverData.json", "utf8"));
client.on("message", message => {
let args = message.content.split(" ");
let data = serverData;
let M = 0;
if (args[0] === prefix + "setHdata") {
data.forEach(D => {
if (data[D].totalCount > M) {
M = data[D].totalCount;
}
});
message.channel.send(M);
}
});
This is a code but get me error in
@solemn jolt are you sure the path to the json file is correct? Try maybe with ../serverData.json
How do I make a disable command, so if a user has administrator perms and/or manage_server perms, they can disable a specific cog/command in the guild, so that it cannot be used?
@rose warren i can do serverData.forEach?
Yes
@rose warren if you look git me error in this line
Ah... Sorry. I just woke up. You can't forEach through an array of objects like that
You have to transform the objects into an array first
How?
I'm not getting any result for this:
elif member == member.id(734822514894831639):
embed = discord.Embed(title=":x: w-why do you want to ban me? What the heck did I do? :(")
await ctx.send(embed=embed)```
Is there a problem? Also how do I make it so the bot cannot ban itself?
Here's something to get you started https://masteringjs.io/tutorials/fundamentals/foreach-object
@rose warren thak you๐
No problem! ๐
It makes me nervous this bug
That's discord.py, not discord.js
Sorry
its k
Does anyone know how I could solve the fault?
@leaden rover what do you mean make it so the bot cannot ban itself?
Well, if I try to use the ban command, on the bot, it would be able to ban itself
@earnest phoenix https://dis.gd/gwupdate
thanks
Just check if the user id mentioned in the ban command is equal to the client id and if it is then return a different result.
what
Since when can bots ban themself-
ok
@leaden rover in your code it looks like the id you're trying to compare with is a number not a string? I don't know discord.py but in JS ids are strings
Do what if what's not an ID?
are there problems with autopost=True in the python lib? #topgg-api message
how can i get spo party link
@white sun None as far as I'm aware
What's your bot's actual server count and what do you get when fetching the API directly via /api/bots/<bot_id>?
@slender thistle ill quickly check, wait one moment
153 servers via the api and 167 servers with discord api @slender thistle
you can see it here (so servercount with discord api) #265156322012561408 message
Guys where to make the bot from any website or application ..
@tardy moth ..
wdym @tardy moth
u want a website where u can create a bot so with finished command and all that?
Yes
Haw with phone
idt that is possible not sure
Yeah Narmy
okay
I want a website or application to create a bot
Ok with pc
.
You don t have with pc haw
Help: I have an error
C:/Users/Fryer/Desktop/kine-bot/index.js:590
client.login(bot token)
SyntaxError: Unexpected end of input
can you show your file
LOL
have fun fixing your code
unless you actually put bot token...
if so, you are retarded, i'm sorry
๐
"doctor i have a really bad cough"
"i need to take a look at your breathing"
"...no sorry"
๐คฃ
lol
does message.me return my bot as a member?

don't think so
@olive wedge
?
go away

@twilit rapids
this dude is strange
indeed
idk i just saw https://discordjs.guide/popular-topics/permissions.html#permissions-after-overwrites and it has this guild.me setup
so i was wondering if that .me setup existed anywhere else
I dont think so
Some libraries could have message.me as shortcut
but that'd ultimately be either User or Member class in any case since a message author can be either
depending on where the message was sent
k im trying to dm a user that tries to talk to me in a place that I can't respond and here's my code
if(!msg.channel.permissionsFor(msg.guild.me).has('SEND_MESSAGES')){msg.author.send(`I do not have permissions to \`send messages\` to channel <#${msg.channel.id}>`)}
what am i missing(cuz it doesn't handle the error)
So, how do i remove the , when i .map()?
join it
@viscid gale no errors?
you can use `${channel}` for mention, same goes to roles, users, members, roles, and emojis
Thank you flaze.
@viscid gale no errors?
@pale vessel no the exact error i was trying to handle still happens
what's the error?
"missing permissions"
can you check whether you used the same method before checking for permissions?
@viscid gale if you have any code after that if, it will still run, because you dont return
unless you have an else
i do
the full code isn't what i gave, but it isn't that kind of error
it's the error where i miss the permissions to respond in a channel
thats what im saying
if(myResponse!=""){
if(!msg.channel.permissionsFor(msg.guild.me).has('SEND_MESSAGES')){msg.author.send(`I do not have permissions to \`send messages\` to channel <#${msg.channel.id}>`)}
else if(myResponse.length>=2000){msg.channel.send(`<@!${msg.author.id}>, my response to your request would be too lengthy\nPlease try a request that gives a shorter response`)}
else{msg.channel.send(myResponse);}
}
else{msg.channel.send(`<@!${msg.author.id}> I was unable to process what you just told me. Please use a valid command\nTo see the list of commands, type the following command below\n${myBot} commands`);}
messages r sent, it's just that that specific situation i still can't handle
put a console log in there to see if its actually being run
well the last elses work
if i ping my bot without proper command, it's handled and when i ping my bot with a real command, it responds
i mean
put a console.log inside the if(! permissions) before the msg.author.send
to see if that if block is working
oh
ite just tested the 2000 length part and it also works... gonna do what u said now
-botinfo 736933259178541177
736933259178541177
Avio but spooky
1150
Multi purpose discord bot ranging from antiswear to image manipulation with a web dashboard coming soon!
discord.js
a!
6
7
No server count
@sharp thicket
@arctic igloo
huh wtf
What's wrong with this code
const guildCount = (await client.shard?.fetchClientValues('guilds.cache.size'))?.reduce((acc, guildCount) => acc + guildCount, 0);
const shardCount = client.shard?.count;
const shardId = client.shard?.ids[0];
await dbl.postStats(guildCount, shardId, shardCount);
It posts more guild count
That is, guildCount is around 2900, after posting, it becomes around 4800
you're posting the total guild count for a single shard id
ie, if you have 2 shards with 1k guilds each, you're posting 2k from shard 0, and another 2k from shard 1
No, it only posts from shard 2
Am I supposed to post only the guild count in that shard and have to post from each shard?
either post the individual count from each shard, or post the full count for all shards
I post full count for all shards in shard 2 currently
So the guildCount is 2900 but I see 4800 in the website
top.gg accepts an array of shards, not sure if the library also does
but try dbl.postStats([1500,1400]) for example
1 sec
No, the library doesn't accept array
I don't see any reason about why it thinks the guildCount is 4800
async postStats(serverCount, shardId, shardCount) {
if (!serverCount && !this.client) throw new Error('postStats requires 1 argument');
const data = {};
if (serverCount) {
data.server_count = serverCount;
data.shard_id = shardId;
data.shard_count = shardCount;
}
It simply sends what I provide in argument
That's exactly what I'm passing to postStats which doesn't change anything but it somehow becomes 4800
dont reduce it
@quartz kindle The library accepts only array, should I directly use the API then?
I mean, I don't see why it become 4800 tho
the library passes whatever you give it, it doesnt do anything
Yes, it passes 2935 as server_count, 2 as shard_id, 3 as shard_count
But in top.gg, I see 4890
yes, likely because it expects something form other shards but it never receives
thats why im telling you to send them as an array
Alright then
instead of 2935,2,3 you send [1000,1000,1000],undefined,undefined
the shard count will be obtained from the array length
and each index is the shard id
oh youre using ts?
Yes
But when I use in TS it says only number http://prntscr.com/vb66ck
Yea well, in typings, it's number
ye typings are def wrong
I'll submit a PR then?
sure
lmao
my test condition is correct, but the block isn't running
But last commit is 20 days ago 
I'll just sumbit a PR then and come after 1 week and see
its not the only typings issue
ah
bruh
I'll just try maybe then
For now I'll just put my files into the dblapi.js folder
oh shidd don't bother, i just pulled a retarded :l
I've literally copied the same thing and it doesnt work.. it works with yt urls
jsut not with names
all dependencies are latest
can someone help
pls
ye its a throw away test bot anyway imma be deleting it later once this works
my discordjs is also latest
;-;
of course it only works with urls
what else would it work with
you need to convert the name to url
and you need to use yt api
on the discord-player doc it says all i need to send is "despacito"
and it'll do the searching for you
i've installed the dependency packages also ytsr ytdl-core etc
@crystal wigeon if you just wanna do that maybe you should go with distube instead of discord-player
ah yes i came accross distube yesterday but was hung up on getting thsi to work and forgot about it. was gonna try that next
search function? but in the doc they just pass the "despacito" in the args
the comment like clearly says "!play Despacito" will play the song
ask the developers then
Also i need help with somethin'
I'm making a multiguild bot, is quick.db good? I mean when the bot gets in servers with thousands of members, will the json file be able to manage it all? No shards at this point.
and you removed your code, so we can't help you either ways
@prisma bramble quick.db doesn't use json files.
@crystal wigeon also I just checked, there seems to be an issue with ytsr at the moment so search will not work
there's an issue with the error callback i guess. even tho i added try catch it still seesm to break
i was gonna try out the older versions
but
@crystal wigeon can you put the error here?
The error you get when you do "!play Despacito"
yep
and i've added try catch block but it still seems to crash
it does look like the error is in the package itself
One message removed from a suspended account.
Indeed
yeah
One message removed from a suspended account.
discord-ytdl-corre
One message removed from a suspended account.
One message removed from a suspended account.
discord-player uses that as dependency
so
dahek
One message removed from a suspended account.
One message removed from a suspended account.
merry christmas
i been trying since past 3 days xD
Currently our dev repository is taken down due to DMCA takedown notice by RIAA.
One message removed from a suspended account.
Dude's literally using the example code from the website and it didn't work, I guess you'll have to ask whoever wrote discord-player
Latest (v2020.11.01.1) downloads:
youtube-dl youtube-dl.exe youtube-dl-2020.11.01.1.tar.gz
See the right for more resources.
Find this androz guy ๐
oof
Try using distube
thanks for the update tho
yeah
so now i know it wont work even if i use an older version
Discord-player kinda broken
hopefully they fix it soon
the package was also a beta-1
thanks guys
โค๏ธ
much love to the community
i just noticed distube also uses youtube-dl ๐
Distube works perfectly, trust me
imma give that a try
I'm using that for my Music Bot
sure, sup?
i did send you a code snippet the other day when you asked the same thing
client.user.setPresence({
activity: {
name: z!help | beta v1.0.0,
},
});
yes
you need to initialize your client first
which is discord client
replace "name"
i mean
the contents
to seet it with the status
you want
const discord = require("discord.js"),
client = new discord.Client({
partials: ["MESSAGE", "REACTION"],
});
client.user.setPresence({
activity: {
name: your status,
},
});
thats the entire code snippet
um, just copy paste the code i sent
lol
it still wont work because its outside a ready event lul
@prisma bramble unable to install dsitube :((
well, let him figure that out
no spoon feeding xD
youtube-dl gone, distube
bruh
@earnest phoenix you need a string there not just words
replace 'your status' with your status string
maybe learn a bit of JS before trying to make a bot, darling.
You think that's funny? smh.
lmao
is it better to show custom swear words if channel is nsfw marked or spoiler it if not nsfw marked channel
Useful links for learning JavaScript and Node:
Javascriptinfo: https://javascript.info/
Codecademy: https://www.codecademy.com/learn/javascript
FreeCodeCamp: https://www.freecodecamp.org/
Udemy: https://www.udemy.com/javascript-essentials/
Eloquent JavaScript, free book: http://eloquentjavascript.net/
You-Dont-Know-JS: https://github.com/getify/You-Dont-Know-JS
NodeSchool: https://nodeschool.io/
CodeSchool: https://www.codeschool.com/courses/real-time-web-with-node-js
Still not a String.
learn js
put " at the start and end of your sentence
yeah learn js
is it better to show custom swear words if channel is nsfw marked or spoiler it if not nsfw marked channel
@earnest phoenix anyone can tell which is better .-. idk what to do
Strings are one of the first things you'll learn with javascript, it's day 1 stuff, it's important.
"Swear Words" aren't NSFW, @earnest phoenix
That's up to you?
Ig i will spoiler it
most people don't fucking care ๐
yes no one || fucking || cares
yow pay me imma teach you js
ikr
and i just realized that thats a command
xD
really dude?
Top Thing to do first before asking for help:
- Read the error and try to find out the issue and fix it.
- if you don't know javascript basics. First learn that.
youโre gonna be racist because you dont knoe shit
know
gl with finding help after that
rip
?
People just try to help you but if you do not know the basics that does not make sense
hwo did you even find glitch
Hey @oak cliff mind taking a look at this #development message
do you know how to "hello world" on glitch?
if he deletes
๐ค Muted Mega_Hunter#4379 (@lapis aspen)
tyty
rip him
lmao
poor dude
xD
Copy/pasted from a tutorial of course.
when you dont know what you're doing. you really dont know what you doing
lmaooo
That was pretty typical tyler behaviour, unfortunately.
Doesn't want to learn, copied their entire code, gets angry when called out on it and told to learn js.
I remember When i first started coding. I would spam my friend's dm with issues but not be racist to him .-.
For future reference though that wasn't racist, that's antisemitic.
Ah
That was pretty typical tyler behaviour, unfortunately.
Doesn't want to learn, copied their entire code, gets angry when called out on it and told to learn js.
o0f
@solemn jolt guild owners are not guaranteed to be cached
you need to fetch them first
@quartz kindle how?
let owner = await message.guild.members.fetch(message.guild.ownerID)
ownerID
yes, ownerID always exists
Ok thank you
Or just literally compare message.author.id !== message.guild.ownerID
does anyone have an idea on how to check if a user in a guild, withiout using cache
in discordjs
lmao yeah, what evie said
@fiery canyon not without the cache no, you'd have to try to fetch the member by ID
@umbral zealot ok thank you too
๐
message.guild.members.fetch(id)
well you can fetch(id,false), which is techincally not using the cache xD
i don't what's fetch?
i don't know why i tried that, and it still fetched a result, without the user being in the guild
if the user is in a guild, it returns the user
if the user is not in the guild, it will error out
yeah it literally throws a promise rejection error
well yeah i was using .catch() and then returning
but it didnt return
cus right now i'm missing the server members intent, and trying to fix some bug with users being permanently cached
fetching doesn't require the privileged intents though
when you fetch, it adds to the cache as well as return the user data
yeah i believe
@solemn jolt
.cache.get() = get it from the cache if it exists, which means its saved inside your bot, if not, returns undefined
.fetch() = get it from the cache if it exists, if not ask discord to send it to you and then save it in the cache
await message.guild.members.fetch(id).catch(x => { ... }```
that's what im trying to use, yet it still do what inside the catch
@umbral zealot evie.dev is your website?
@quartz kindle thankyou
yes it is!
lol
@fiery canyon js let user = await message.guild.members.fetch(id).catch(x => null); if(user) { console.log(user) } // user will be null if the fetch failed
@umbral zealot awesome, very nice content
Danke ๐โโ๏ธ
bitte :3
Does anyone know DBFD?
i know what it is but never used it
Iโm trying to make an command thatโll allow users to redeem an code and get items or Mahoney but Iโm not sure how to make it
Iโm still pretty new to it
hello, is anyone using the evaluate party of puppeteer?
does dbfd have any kind of persistent storage or database system?
No itโs just a code app for mobile to make bots
Well Iโm not sure actually
It saves the code onto your bot but you canโt access it apart from the code youโve written
It uses variables tho
And hosts your bot
bruh it still doesnt null if the user isn't in the guild
how is this possible
the user completely left the guild, and yet it fetches their object
maybe it still in the cache. have you tried to fetch and put the force boolean to true (disable cache)
have you considered making your own bot from scratch instead of using a bot designer? @safe creek
even on mobile there are quite a few ways to code (albeit not as great as desktop)
have you considered making your own bot from scratch instead of using a bot designer? @safe creek
@fluid basin itโs not a bot designer?
I made it from scratch?
maybe it still in the cache. have you tried to fetch and put the force boolean to true (disable cache)
you mean like.fetch(id, true)?
oh wait
.fetch(id, { force: true }) actually
Db script?
Woah
yeah ok
That's discord bot designer?
but you're still limited to many things
Yes but I asked support and they said I could make an command and allow users to redeem codes
Just not sure how
well, you can always store your codes in discord xDDD
I don't think so
Like voting for your bot?
Mhm and getting like
should be possible
2x boosters idk
No, the api doesn't support vote commands
do they even allow external packages?
I'll contact them since I'm an alpha tester
doesnt dbd allow js code?
No, the api doesn't support vote commands
@solemn latch in some bots when u vote them u get perks
doesnt dbd allow js code?
@quartz kindle it does
allowing js does not mean you get access to installing and managing packages
^^^^
then you can always use the built in http modules, since it runs on nodejs
and it might not even be the full subset of nodejs
Well they will soon add packages I think
Vote rewards use the webhooks @sick condor
dbd is based on discord.js isnt it?
Yeah
It was on v11 not long ago right?
well again, the code might not be natively executed
It has its own code as well
discord.js uses node-fetch internally
so node-fetch should be included and accessible
Exactly
try doing require("node-fetch") with js code
It works
then you can use the api
now try using require("http")
hmm really
maybe I haven an issue on the code hold on let me remake it
So I made one command on which it changes the status and I want it that only I can use that command. So I tried coding it but it's saying me like You don't have perms to set status. Lemme send the code too.
Language= discord.py
if http works, then you can use webhooks as well
async def changepresence(ctx,*,text):
if ctx.author.id == "707198291246579732":
await client.change_presence(status=discord.Status.idle, activity=discord.Streaming(name = f"{text}" , url = "https://www.twitch.tv/pokimane"))
await ctx.message.add_reaction('โ
')
embed = discord.Embed(title = "Success!" , description = f"I have changed the Bot Presence to {text} !" , colour = ctx.author.colour)
await ctx.send(embed=embed)
else:
await ctx.send("You don't Have Perms!")```
xD leave that url
Someone help me lol
Ok
no, the id is correct
streaming pokimane lmao
huh why it gives me 772468608697761802 as his id?
you copied the message id
ohh fuck
lmao
aight imma kms see ya
why is typescript yelling at me
i have strict null checks on
so I used ? but typescript is being mean
Do you use the last version of TS ?
I'm using 4.0.3. The null collapsing (I think it's how it's named) optional chaining is pretty new so maybe by upating to TS4 it would fix it
ok, will go ahead and give it a try
for me it gives 707198291246579732
@quartz kindle lmao
I'm using 4.0.3. The
null collapsing (I think it's how it's named)optional chaining is pretty new so maybe by upating to TS4 it would fix it
@subtle kiln my bad, it was introduced in 3.7 and had a breaking change in 3.9. It's indeed pretty new but updating to 4.0 should change nothing
Is this when running the typescript compiler or when running the transpiled JavaScript?
@sick fable flaze told you to remove the quotes around the ID because it is an int, not a string
So is there any way by if I message to change the bot presence?
@sick fable then why'd you say this?
Because my mind was fluctuating
oh
Thanks!! @pale vessel @hollow sedge
It worked
I am streaming Pokimane 
I hope that my bot doesn't get rejected
Lol
simp

i would need help with https://discord.com/developers/docs/resources/guild#list-guild-members
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
if anyone could help me
kindly explain what you need help with
are intents needed for fetching a guild member without cache
i would like to know how many people are in a server
no
cus my client still magically finds the user, even when they're not in the guild
hey i am using disordgo anyone knows how to use PermissionOverwrites struct i am stuck on Type
and i didnt realy understood how this work
@earnest phoenix which library are you using?
how can i get this party url
im using request
i using user.presence.activities
hey i am using disordgo anyone knows how to use
PermissionOverwritesstruct i am stuck onType
on go doc it says thatTypeis string type but in developer portel i saw it was int (could be either 0(role) or 1(member))
{"message": "Missing Access", "code": 50001}
this is the error code @quartz kindle
https://discordapp.com/api/v8/guilds/769916241799413820/members this is the url i made a get one
on
did you provide the authorization header
yes i did authorization : token_of_bot
is the bot a member of that guild?
yes
its appear in https://discordapp.com/api/v8/users/@me/guilds
tested with several id of serv tho
does your bot have the server members intent toggled on in the dev portal?
its isnt by dfault?
not anymore
ohh
that prob wh
why
may you help me with smthing else realy quick?
i wanted to do thing on several bot in one run
is there a ways to do it?
Hey, should I just fix this error by doing what it says? I'm caching members and that's what it comes from.
-'/channels/xxxx/messages?limit=1' get```
someone has 6 bots in a single process iirc.
i remember it being a nightmare for them however
#---------------
import discord
#---------------
tokens = []
class Bot():
def __init__(self):
bot = discord.Client()
@bot.event
async def on_ready():
print("done")
await bot.logout()
for i in range(len(tokens)):
TOKEN = tokens[i]
bot.run(TOKEN)
bot = Bot()```
tryed like this
but didnt work
you need to create a separate client for each
its stuck at 2nd by telling me sys:1: RuntimeWarning: coroutine 'Client.run.<locals>.runner' was never awaited
how could i do that?
this is where the client is created bot = discord.Client()
ye but cant i destroy client once its done?
like
delete and recreat with a new token?
well, you can, if you want to run one at a time
but its better to create a new client, to make sure the client is clean
also, if all you want is to use the rest api, you dont need to connect to the gateway
how do i "destroy" a client?
im bad in english can you explain your sentence please
check the docs
well i didnt found on the docs that why i ask help ๐
search for destroy and you'll find it lmao
what error
sys:1: RuntimeWarning: coroutine 'Client.run.<locals>.runner' was never awaited
you didnt await bot.run()
yes but if i do await bot.run() its say await outside a asyncio function
should i do an other bot.run?
#---------------
import discord
#---------------
tokens = []
class Bot():
def __init__(self):
bot = discord.Client()
@bot.event
async def on_ready():
print("done")
await bot.logout()
for i in range(1,len(tokens)):
TOKEN = tokens[i]
await bot.run(TOKEN)
bot.run(tokens[0])
bot = Bot()```
like this?
cause there is several bot
he wants to run multiple bots, one at a time, execute an api call then destroy the client
?
like i want get info on serv where the bots are in order to make stats and i need them to do bunch of thing
then
log off
and do with next bot
F
the problem in this line
@quartz kindle hello no time no see ๐
can you help me fix this problem
owners are not guaranteed to be cached
when a guild kick my bot this error happened and my bot start to reset
owners are not guaranteed to be cached
@quartz kindle 2 days ago it is still fine
you need to fetch the owner
Probably because of intents?
oh well i need smthing like this
but that do several bot
well your script run 1 bot or its run several bot?
like its give stats of 1 bot
or of several one?
1
oh well not exactly what i need
So I have 2 shards, shard 1 there is a guild, shard 2 wants to see if a user has a role in that shard, how would I do that
So I have 2 shards, shard 1 there is a guild, shard 2 wants to see if a user has a role in that shard, how would I do that
@obtuse jolt fetchClientValues(), i guess
woah that's a ton of users
help Shiro-chan ๐
@hollow sedge trust me, users isnt a great deal. Servers is
@hollow sedge trust me, users isnt a great deal. Servers is
@prisma bramble 1,820 servers is still a lot
@cerulean pebble you need to fetch guild owners, otherwise they may not exist in the bot's memory, because discord doesnt send them by default, you need to ask discord to send them to you
the question why 20 mins ago everything still fine
await guild.members.fetch(guild.ownerID)
you dont need to replace it
you just need to fetch it before trying to use guild.owner
so add it where ?
before trying to use guild.owner
he already did lol
lmao
:)))))
2020-11-01T15:42:03.038769+00:00 app[worker.1]: stats 299Users,48957Channels,1820 Servers!
270 000 ->299 :))
? what's your point
we already knew there was a problem
await guild.members.fetch(guild.ownerID)
from tim
we already knew there was a problem
@hollow sedge from discord ?
no, we already knew there was a problem with your bot
@quartz kindle So I have 2 shards, shard 1 there is a guild, shard 2 wants to see if a user has a role in that guild, how would I do that
oh i discord anything
@obtuse jolt broadcasteval
I tried to use broadcast eval and nothing happened
Maybe I just donโt know how to use it
How would I do it
what did you try
Well when I tried broadcast eval for the first time I tried console.log and nothing happened
broadcastEval returns a promise with an array
How do I use broadcast eval
let results = await client.shard.broadcastEval("if(this.guilds.cache.has('guild id here')) { return 'yes'; }")
console.log(results) // [undefined,"yes"] // if the guild exists in shard 1 but not in shard 0
@earnest phoenix sorry, i dont use discord.py so i dont know much about how to properly kill it
ok
@earnest phoenix use JS better ๐
@earnest phoenix what exactly are you trying to do tho, like what do you want the bot to do before killing it?
i dont know a shit about js sadl
get bunch of info (didnt choosed all info yet) but for exemple the number of member
the owner id
@cerulean pebble that will likely produce a weird result but try it
and thing like that
@earnest phoenix depending on the info you want, you might not need to connect it at all, you could get it from the rest api
well i tryed api but i dont rly understand it ๐
{"message": "Missing Access", "code": 50001}
this is the code i get when i try the url for the number of member
how many times are you going to run this job?
like how often do you want to update the stats
every few day
ah ok
not real time stats
why?
but i will need run the get for each serv my bot is in
for each of my bot
i would try something like this ```js
import discord
tokens = []
for i in range(1,len(tokens)):
client = discord.Client()
@client.event
async def on_ready():
print('client {0} logged in'.format(i))
client.run('your token here')
but im not a python user so idk if thats correct
ok let me try this
gather the stats you want inside the ready event, and once you got stats for all bots, just exist the process
ahaha I just broke my console
(node:22752) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of null
at Client.<anonymous> (D:\dbots\EyeBot Security\index.js:21:17)
at Client.emit (events.js:315:20)
at Object.module.exports [as GUILD_CREATE] (D:\dbots\EyeBot Security\node_modules\discord.js\src\client\websocket\handlers\GUILD_CREATE.js:33:14)
at WebSocketManager.handlePacket (D:\dbots\EyeBot Security\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (D:\dbots\EyeBot Security\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (D:\dbots\EyeBot Security\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (D:\dbots\EyeBot Security\node_modules\ws\lib\event-target.js:125:16)
at WebSocket.emit (events.js:315:20)
at Receiver.receiverOnMessage (D:\dbots\EyeBot Security\node_modules\ws\lib\websocket.js:797:20)
at Receiver.emit (events.js:315:20)
(node:22752) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:22752) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
guild.owner.send()
i have ALL intents in ws
show code

are you sure the owner is cached?
you can have the intents, but that doesn't mean that the client cached the guild owner
unless you explicitly enable fetchAllMembers in ClientOptions
what doesn't work?
"user"
you sure the owner is cached
TypeError: Cannot read property 'user' of null
yeah
i can not imagine what were happen
@pale vessel Tim give me a option but it is not workerd
how do I manually push my guild count?
what did you use?
@obtuse jolt POST top.gg/api/bots/stats
application/json
"{\"server_count\": 100}"
for example
oh and authorization
isnt there a thing on the module?
yeah
i thought you asked that since the module is deprecated
but you can use the module, yes
what is the thing on the module for manual pushing?
postStats? not sure
would it say on the module npmjs page?
it didn't, just checked
damn
found it
awesome thanks
@cerulean pebble i told you, you need to fetch the owner
BEFORE trying to use it
guild.owner.id // error
await guild.members.fetch(guild.ownerID)
guild.owner.id // works
you can also do ```js
let owner = await guild.members.fetch(guild.ownerID)
owner.id // works
hey @quartz kindle how would I add up all the values in an array
reduce?
reeeeeeeeee
redux
you use redux?
๐ฎ
recycle, yes
trash
how can I get the background-image CSS element to work on my bots page? Its the only component that doesn't work/load properly
where do you want to put the background?
I have it associated with the body but that didnt work. Tried to set it as a class on the body tag but that didn't work
its just a linear gradient , not an image
but do you want to put it in the body of the website?
if so, the body selector should work
for me i had to use #bot-details-page
I dont want to set it as that. here is my descript part on my bots page. The dark grey area is the body and there should be a linear gradient loaded onto that
the dark gray area is not the body
there is only one body per page
top.gg's body is the one i showed you in the pic above
let owner = await guild.members.fetch(guild.ownerID)
2020-11-01T16:28:36.959534+00:00 app[worker.1]: ^^^^^
2020-11-01T16:28:36.959535+00:00 app[worker.1]:
2020-11-01T16:28:36.959535+00:00 app[worker.1]: SyntaxError: await is only valid in async function
i forget to mention this
:))
make the function async
For the bots description, I added my own HTML/CSS but the background-image component doesn't load.
yes, but there is only 1 body
you cant put another body inside it
your whole custom html should not have body nor head elements
ok, that fixed it, thank you Tim ๐
im trying to use this bot nothing actually happens https://cdn.yxridev.com/u/OmkKy27Q.png
@quartz kindle i tired at least 10 times and discorvered that
the problem is user not guild.owner.id
and btw
the bot is normal if someone kick her and add her after 5 mins turn on
like delay time
so i have a option that i will make 2 cases
@client.check
async def user_blacklist(ctx):
if ctx.author.id == 475315771086602241:
await ctx.send("You have been blacklisted from using ฮ X 0")
else:
return
```Does anyone know why this says check failed?
It has to return True to signal the user passed.
You returned None.
On both occasions.
im making an all in one bot what should i call it
@quartz kindle is it possible to have multiple events for colleting messages from shards in the manager each with their own purpose?
any other python devs here
yes
sick
@obtuse jolt sure, why not
how would I be able to do it?
I don't get that
the sending to the custom one and receiving it too
give it a name field or something to identify it
then check this field to figure out which one is it
how would I be able to access this in the shard? https://cdn.yxridev.com/u/OVfnLuwB.png
@quartz kindle
@quartz kindle i do not understand why i am open bot she lost 5 mins to know what user is and the command work
like first 5 mins command error and come to normal in 6th to return
@obtuse jolt if you want to create custom events, you have to process them in the message listener and re-emit them
for example ```js
shard.on("message", data => {
shard.emit(data.type,data.content)
})
and then you send it an object containing a type field
client.shard.send({type:"guilddata",content:{memberCount:999}})
There is not space after comma 
@cerulean pebble i already told you why lol
do you not understand how caching works?
@cerulean pebble i already told you why lol
@quartz kindle sorry :/
but i tired your code :/ but did not bring any effective
show code
Best way to host your bot?
VPS
Google?
it is happened when a user add bot when my bot not complete the fetching all of 255 000 users
i already told you
make the function async, and fetch the owner
async guild => {
await guild.members.fetch(guild.ownerID)
hmm sir i will try again
@quick ridge attachments dont have a url until after they are sent to discord
so you cannot show the attachment url there
also guildCount and bann...whatever that is, are redudant
you're declaring 2 variables for the same thing
@cerulean ingot
lmao
thats how i got my bot name at least
you can modify them a bit if you want
works out great
or translate a word in to latin and work from there
i would probably put more commitment than that tbh
whats your bot i wont steal it lmao
at least something unique or that's similar to what your bot does
yeah
^^
its an all in one bot
take somthing for all in one or everything or something like that
name is one of the most important things about your bot
i'd recommend thinking thoroughly about it
ooo thats cool

using moment, how can i change the time zone to GMT? (nodejs)
moment().format('dddd Do MMMM YYYY H:ma') is 8hours behind my timezone
I'm trying to figure out how Discord permissions work (not sure if it's the correct channel but it's related to the dev of my bot). For a test I removed all permissions of @everyone on a server and created a new role "member" that can see channels, read/write, etc... However this role can't see any channel. Why?
because if @ everyone is disabled, then member has to be enabled
@quartz kindle can you send JSON like this?
@ everyone will override member if member does not forcefully say that it can do it
@blissful coral do you code in opython
@ everyone will override member if member does not forcefully say that it can do it
@blissful coral but the "member" role has the permissions to see channels and read/write
If someone knew they would respond to your question
moment().format('dddd Do MMMM YYYY H:ma')is 8hours behind my timezone
@queen crescent use moment-timezone instead of moment and do something like that:
moment(date).tz(this.effectiveTz).locale(this.effectiveLang).format(format)
@subtle kiln
@everyone 
member 
sorry but I don't really understand what you are saying
Check mark all perms for member in the channel
if all everyone perms are xed'
give the person member they can see channel
@obtuse jolt sure
@subtle kiln this.effectiveTz would be like this.effectiveTz = 'GMT' right?
I tried it but nothing happened @quartz kindle
#AddDevelopment2
@quartz kindle https://cdn.yxridev.com/u/pGE40PN8.png
https://cdn.yxridev.com/u/Ia4FdYNg.png
https://cdn.yxridev.com/u/T8A3oeml.png
https://cdn.yxridev.com/u/E9HnLYZx.png
it doesn't do anything
That would work but that's not my question. The channel permissions are neither on X nor V, just the default value /. What I don't understand is that the user has the permissions, the channel permission don't overwrite its permissions but in the end, he don't have the permission to see the channel and I don't know why (sorry for poor english)
@subtle kiln this.effectiveTz would be like this.effectiveTz = 'GMT' right?
@queen crescent you replacethis.effectiveTzby the value that you want like"UTC"or"Europe/Paris"
If everyone is at X and member is at / then member will not override it because it is already being denied by everyone
neutral means it will check for permissions on all roles of the user (including @everyone) and then check it yes or no
the member isn't at X in the channel permission
is @everyone?
neither
message.channel.createWebhook(isim , avatar)
.then(webhook => webhook.edit({name: isim, avatar: avatar} )
.then(wb => {
const hook = new Discord.WebhookClient(wb.id, wb.token);
hook.send(yazi)
}).then(hook.delete({ timeout: 2000, reason: 'HOOK silinmesi' }) )
.catch(console.error)) ```
i cant delete webhooks
with this code
why ?
My bot is no longer playing YouTube music. Error Code: write EPIPE
Please help me. Thank you ๐
the chain is wrong



