#development
1 messages · Page 1198 of 1
Love the video or need more help...or maybe both?
💬Join us on Discord: http://discord.gg/invite/fw5cKM3
This series is outdated!! We have a new series playlist here!
https://www.youtube.com/playlist?list=PLdnyVeMcpY7_IiC977keSLBXXJG_I3vUo
Thank y...

looks awfully like that one
but with author rather than footer
Vx_avatar PedroKarum
yeah it does
Vx_avatar @digital wagon
😉
bcs Im using beautify
=m/avatar PedroKarim64
what does beutify have to do with this?
WRONG CHANNEL
wdym
I‘m too dumb, sorry.
can you help me with wat I asked?
bcs Im using beautify
@solemn leaf just after ", do a \n 
imma go ask somewhere else then 🤦
Bruh
what
Kinda wonder if that would actually work
https://discordapp.com/channels/264445053596991498/272764566411149314/748985255595344014
It'd miss tabs of course
a!eval let n = message.author.presence.activities.find((a) => a.name === 'Custom Status')
JSON.stringify(n.testin)
Im trying to get the status
could you help
Hmm
let n = message.author.presence.activities.find((a) => a.name === 'Custom Status')
JSON.stringify(n.state)
What does it return?
On mobile rn so cant do much but if u giv me enough info i can help
What
let a = "900"
var intervalId = null;
var varCounter = 0;
var varName = function(){
if(varCounter <= a.charAt(1)) {
varCounter++;
message.channel.bulkDelete(100)
} else {
clearInterval(intervalId).then(() => {
message.channel.bulkDelete(a - a.charAt(1) + "00")
});
}
};
intervalId = setInterval(function() {
message.channel.bulkDelete(100)
}, 1000)
uh oh im trying purge more than 100 messages with interval
but thst interval does not stop
wait wtf
@solemn leaf why the heck you stringifying a string?
setINterval is not meant to stop
if you want a loop that stops you using the wrong thing
i wants it will purge 100 messages then again then again to wants messages size to purge
thats api spam btw
oh uh it will be slowly
i have seen this a lot of bots (verified bots)
¯_(ツ)_/¯
like carl, dyno
even they say in the verification that some bots recieve different stuff
```Remember, not all use cases are the same. You may see some bots that have been verified that toe the line; verification is a manual review process, and therefore a human has laid on eyes on every bot that passes through. Therefore, we have deemed that individual use case alright.````
source: https://support-dev.discord.com/hc/en-us/articles/360043053492-Statistics-Bot-Verification-Policy
discord does make exceptions more often than you'd think @hazy girder
how canI get what client a user is on
if the bot is missing permissions, it still says "Error!", how do i make it say "Missing Permissions" if it is missing permissions?
how canI get what client a user is on
@solemn leaf presence
I know with presence update event you get like desktop: onlinr
etc
In top.gg what is the detailed description field for?
Do i have to know html and javascript to use it?
👍
if (ment.presence.clientStatus === "mobile") {
image2 = "https://cdn.discordapp.com/emojis/734835368427389099.png?v=1"
}
if (ment.presence.clientStatus === "web") {
image2 = "https://cdn.discordapp.com/emojis/734835368423063664.png?v=1"
}
if (ment.presence.clientStatus == "desktop") {
image2 = "https://cdn.discordapp.com/emojis/734835368204959857.png?v=1"
}
so I can just do this
@thick gull
if clientStatus is an array you can access the [n] index
[0] is the first index
[1] is the second index
and so on
But I suspect it isn't an array
@solemn leaf
It's looks like a prop like Not Erwin#8753 said
how do i make it like what i send
so like if i do ?check hi
how do i make hi a var
thank
like how do i get what i sent?
it's in your arguments
Anybody know how to fix this? Kinda got confused
npm WARN using --force I sure hope you know what you are doing.
npm WARN vxcomplexity@1.0.0 No repository field.
npm ERR! code EEXIST
npm ERR! path /home/container/node_modules/.bin/yt-search
npm ERR! Refusing to delete /home/container/node_modules/.bin/yt-search: is outside /home/container/node_modules/yt-search and not a link
npm ERR! File exists: /home/container/node_modules/.bin/yt-search
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/container/.npm/_logs/2020-08-28T20_27_50_954Z-debug.log```
just delete the node_modules folder
Anybody know how to fix this? Kinda got confused
Node:I sure hope you know what you are doing
@earnest phoenix
that always fixes it :haha:

@faint prism <Using force does that> without it still same
BotMissingPermissions
@slender thistle that nor discord.Forbidden din work
I have no doubt it's because you did --force.
I just find it funny in the context
is there any way to set the status of a bot as mobile
you need to modify your lib
Yea i know, it said use --force to overwrite it recklessly so idk @faint prism
is there any way to set the status of a bot as mobile
@worthy glacier its against the api tos iirc
it isn't
o
discord probably doesn't like it but it isn't against the tos
It's against guidelines, modifying the gateway identifier
uh
no
oh guidelines
if you set the device in the IDENTIFY gateway payload to mobile the whole connection gets treated as a mobile connection, you get the mobile indicator
So cry got any ideas about my error, I'm confused
have you tried deleting the node_modules folder yet?
if you wanna re-install everything i suppose
I mean if that's the only way to fix the error i suppose?
running npm install redownloads the modules anyways
Yea, lemme try
Gotta love how dangerous a typo in bash can be
||sudo rm -rf / node_modules/ #Dont copy and paste this||
Gotta love how dangerous a typo in bash can be
||sudo rm -rf / node_modules/ #Dont copy and paste this||
Hackerman ? oof
how do i like check it this is this
like how do i check it the command has the code?
async def verify(ctx, arg):
if arg == 9999:
add_roles('699779377113727136')
await ctx.send(f'Welcome to the losers club / Verified!')
else:```
Wouldn't that be calls from dbl's #topgg-api ?
like how do i check a message against another message
and if its true, do this
like a veriffy thing, that they need to put a code
I'm using ytdl-core to stream an youtube video's audio on a voiceconnection, but does anyone know how I can seek the audio without making a new stream?
client.wait_for
client.wait_for
@slender thistle wait for what lol
I'm using ytdl-core to stream an youtube video's audio on a voiceconnection, but does anyone know how I can seek the audio without making a new stream?
@wheat jolt There should be a "current position" property or something somewhere
@wheat jolt There should be a "current position" property or something somewhere
@faint prism yes, there's a seek option for voiceConnection.play but this means a new stream
@bot.command(pass_context=True)
async def editnick(ctx, member: discord.Member, nick):
try:
await member.edit(nick=nick)
await ctx.send(f'Nickname was changed for {member.mention} ')
except discord.Forbidden:
await ctx.send("I am missing permissions!")
``` how do i check if member or nick is missing?
At the moment I think member and nick are both required arguments.
You'd need to use typing Optional[...] if you wanted to make it optional according to the documentation (I think).
= None works too
You can set default value None to both and then check if both/either are/is missing
.verify
how can I check If a pinged user is a bot
!verify
!verify
@uneven jetty #commands
how can I check If a pinged user is a bot
@solemn leaf isBot might be a Boolean property of a user
You can set default value
Noneto both and then check if both/either are/is missing
PING PONG yeah that worked for me

how to use emoji from other servers? discord.py library
i don't know, most people here
escape it in the server, and copy paste it in your string
i.e
-> \:dblAdmin: -> !dblAdmin
thanks, I'll try now
can someone explain me how i can use Threads in java or what is a good start to learn asynchronous Programming. My main problem is that i have create a discord bot and never realized that one task that have to work a little bit longer blocked all my listeners and i have know i dear how i can rund my methods without blocking any other codes
Is there a reason and/or fix to why my bot takes so damn long to login?
why am I using JSON.parse(stuff) on the YTAPI result and isnt working?
should format the obj to a JSON?
How can I add the index.js file to my bot?
?
The file with all the bot’s code
yeah u want to run it?
I want to post it to the top.gg page
Cause I can’t have it running forever on my laptop
u can add ur bot , not ur code
How can I add my code
thats why u buy a server
bruh
or use heroku
Thanks
Is there any clean way to listen for new channels specifically? The channel create event triggers whenever a channel is added to the cache, including when the bot starts
(Djs)
The channel create event triggers whenever a channel is added to the cache, including when the bot starts
@dusk vault doesn't happen to me
is it a library bug?
I have this
it only triggers when a channel is created, at least for me
async function crash(collected) {
var currentmulti = 1
const crashmsg = await message.channel.send(":loading: "+currentmulti+"x")
var m
var crashed = false
for (m = 0; crashed===false; m++) {
var sleepsecond = 1000-currentmulti*85
var slpsec = sleepsecond.toFixed(0)
await new Promise(r => setTimeout(r, slpsec))
currentmulti += 0.1
if(currentmulti >= multi) {
var toadd = multi*amount
await crashmsg.edit(":check: Cashed out at "+currentmulti.toFixed(1)+"x! You won "+toadd.toFixed(2)+" "+coind.emote)
await connection.query("UPDATE balances SET "+coind.ticker+"="+coind.ticker+"+? WHERE id=?", [toadd.toFixed(2), message.author.id])
crashed = true
} else if(Math.random() < 0.04) {
await crashmsg.edit(":boom: Crashed at "+currentmulti.toFixed(1)+"x! You lost "+amount+" "+coind.emote)
crashed = true
} else {
await crashmsg.edit(":loading: "+currentmulti.toFixed(1)+"x")
}
}
}
which lib @pale vessel
discord.js
but every 5 loops it has a 2-3 sec pause
v12?
yes, of course
Hmph
Ill look into it further
Thanks
Anyone have the ratelimit reference link handy?
k
They're dynamic aka can either change anytime or can be increased
whats the default for channel name updates
2 requests per like 10 minutes iirc
@lilac pollen
if(args[0] === '--biyo') {
let user = message.author;
if (!args[1]) {
return message.channel.send(`**${message.author.tag}**: Komutun doğru kullanımı \`${prefix}rütbe --bio <yazı>\` şeklindedir.`)
}
let infotest = args.join(' ')
blablablabla.......
i have a command like this. when i type /rank --biyo <text>. his biography is changing.
but the biography changes as --biyo <blablabla>. what should i do.
slice the name's length off the start and trim left?
why does my for loop pause for a bit every 5 loops
@dusk vault can you give me a little sample? I am also a beginner
let infotest = args.slice(1).join(' ')
thx. @dusk vault
Hi, I have a problem trying to parse something to JSON from the YouTubeAPI, JSON.parse(thing) isnt working, but the console.log of the thing does show the thing

are you sure you need to parse it?
yo
that it's not already parsed
im stupid
nvm
I was reading at youtube api docs i was reading an older version
the response im getting is already an array
just have to do result[0].stuff

how to print hello world?
I get an error
wtf
do you have a tutorial for that?
r u joking?
yes, I was trying to
@sharp plover you can get banned
advertizing
some dude like was sending his bot thing
Bismillah
sorry for ping
his bot thing?
@sharp plover Why do you think I deleted it
IM PORTUGUSE IM NOT ENGLISE @midnight blaze
Help me
IM PORTUGUSE IM NOT ENGLISE @midnight blaze
@sharp plover br?
I need help
Yes
@sharp plover muchos cracias
:(
Non-English in #memes-and-media
@slender thistle u use jetbrains ide right?
it is a slang here in California
i made an ffmpeg bot thing that works on my pc
we are influenced by spanish people
well, more like putting up with them because of lowend laptop but yeah
@drifting wedge make a dispatcher
you should know this, when using ffmpeg 
guildMember.guild.channels.cache.get('699053185058340876').send("<@" + guildMember.id + ">", {welcomeEmbed}).catch(console.error);Can someone tell me how to properly send a tag and the embed in the same line? My syntax is off.
Currently it only tags the member. It doesn't send the embed.
@fleet hornet User pings start with<@!- And if I remember correctly then you dont need the{}brackets, so like:
[...] ">", welcomeEmbed).catch [...]
yes actually lol
but....
5head
try to make a ping pong bot first
I DID
nxt make a 8ball command
i did lol
as if
my bot is like really advanced lol
What are you trying to do honestly
Other than putting up random pieces of code together
he copied a music bot and is confused by it to run it
use heroku as a music bot hosting
hwyyyy
Because Heroku does support music natively
how about you check the discord js guide about voice
doesn't
get the basics first
oh
true, I forget that people are using py
How do I add my bot to your site? I'm new to discord! As I am Portuguese BR I am using GOOGLE TRANSLATOR 🙂 @midnight blaze
@sharp plover ❤️
-faq 1 @sharp plover
@sharp plover
No fucking idea. Try it tbh
@drifting wedge get vps and you will be making progress
But generally it's a lot simpler to just rent a VPS
so heroku doesnt work
Any idea why is this happening? 
const YTSearch = search(query , opts, function(err, results) {
console.log(results[0].link)
results[0].link.toString()
});
server.queue.push(YTSearch);
Output:
(node:5240) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string.```
heroku is a bad idea, just forget about it and if you have 5 euros per months, go and get a normal vps
yea ik
but like my bot is still in development
can i use heroku
i know its bad
and its def not a good choice
but can I?
You can. "Should you" is the more appropriate question
Run audio on Heroku?
yes, you can
but I think it is has problems, when your music bot is used by many servers
if you want to make a bot for your own server
🙂
lemme get my code
@slender thistle can I link a tutorial for him?
memberCount = len(client.users)
or is it not allowed to post youtube videos here? I think I found something for beginners
this is total members
K
users aren't members
so this is an example
embed.add_field(name="Total Users:", value=memberCount)
users aren't members
@pale vessel for me works great
Something tells me Heroku doesn't support crap like ffmpeg, ytdl, etc.
it does
Oh well have fun with that
it is crap tho, it only will work for your own server
feel free to link tutorials per necessity
ok^^
In this video I'm going to show you how to deploy your Music Bot to Heroku using GitHub as a deployment method.
Link to my Discord: https://discord.gg/bZSwjPy
Link to code repository: https://github.com/ansonfoong/discordjs-commando-tutorial
FFMPEG Buildpack for Heroku: htt...
@midnight blaze love you ❤️
jk
thanks tho
the ffmpeg build pack works with python?
yes, why shouldnt it work with python?
idk lol
i readded buildpack
imma try
how do i load opus?
says opus not loaded
do you have those?
https://github.com/xrisk/heroku-opus.git
maybe this could help
only https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git is needed, iirc
worked fine when i was testing music on heroku with that
worked fine when i was testing music on heroku with that
@pale vessel on heroku?
@midnight blaze I'm finished and now I can send the link?
On here?
@sharp plover 👍 (no clue what you are talking about)
music worked on heroku, surprisingly. headless chrome too
@pale vessel mhm
what buildpacks?
ffmpeg?
youtube dl?
didnt work for me
o_o
maybe cuz of different code
did you restart/redeploy?
can't help much here
is it easy to swap from djs to djs-light?

is it easy to swap from djs to djs-light?
@thick gull yeah it isn't too hard
it really depends what the purpose of your bot it
probably the biggest consideration you need to take is the caches that you need/don't need
i need help
with?
lib?
yes
https://discordjs.guide/popular-topics/embeds.html#embed-preview you'll probably find this useful then
@undone solar what lib are you using?
discord.js @sinful belfry
ah so you can do <client>.guilds.cache.size
or if you're using dblapi.js then it will send your server count automatically
thank you for your quick and accurate answers
-faq 1 @lilac pollen
@slender thistle it didn’t say anything
how do i get a value from a argument. for example a message has the number 5 and i wanna multiply it by 3 but it just returns NaN
discord.js
yeah it did
@slender thistleit didn’t say anything
@lilac pollen https://discordapp.com/channels/264445053596991498/272764566411149314/749032470346727547
How can I put the bot in top.gg after putting it in heroku?
@lilac pollen the #502193464054644737 describes how to submit your bot to tog.gg
how do i get a value from a argument. for example a message has the number 5 and i wanna multiply it by 3 but it just returns NaN
@errant perch Can i see how you do it? I maybe able to provide a fix
likely parseInt incorrectly
or mutiplying string by number
which is why
clears throat, reads ad script
You should try typescript as it catches those hefty bugs before even compiling 
String + Number would turn the number into a string and add it to the string, but if used like this
Math.floor(String + Number);``` it would return NaN
right because `hello` + 5 = hello5
- also means to append
i wonder
but it just wasnt saving
@errant perch If I had a dime
Just Js Things™️
@opal plank Are you making your entire eval an async function
To be able to use await
Well i don't do that, just awaiting if the result is a promise
string
But yea trying to put the whole thing inside a async function just to use await is annoying @opal plank
yes
@earnest phoenix just make everything async :kek:
@opal plank Yes but using return on everything is something that i hate
//index.ts
async function () {
client;
login();
more shit
whole index
He attacc
he protecc
but most importantly
the whole index whacc
}
@earnest phoenix
That's what i do
literally the whole index 
But i do everything inside the message event so we wack
I know
balls deep
C o c k
if you goin g to screw up the code, at elast do a good job at it
be the best at whatever you do, be it good or bad


await impacts a bit of performance iirc
What is happening rn?
aham?
await focuses on the function/promise/static property or whatever until it's done so yes
I saw someone's code today where they implemented a static instance of a class within itself. It was really weird
class MyClass
{
private MyClass _instance = new MyClass();
private MyClass() {}
public static Instance() return _instance;
}
ez pz, make everything async, then once you finish code, do ctrl+shift+f, replace async with '' and fix where errors happen, 300 iq 🧠
@opal plank Exactly
I saw someone's code today where they implemented a static instance of a class within itself. It was really weird
@faint prism it's actually a common pattern for libraries - i.e when you need to create a single instance of a class and keep it alive all throughout the lifetime but not allow any more creations of it
mostly used for reflection
mostly used for reflection
@earnest phoenix It was in some productions code. I was getting a really weird exception when creating unit tests for it.
Really banging my head against it.
I ended the day by removing the GetInstance and it's references so I could register it in our IoC container
So hopefully that works
@earnest phoenix I formatted your index file today (the one I had for the backup) and it made like 80 errors so I just uploaded it the way you had it lol

In my index.js file, everything goes by my rules, change something and you're in hell
In my index.js file, everything goes by my rules, change something and you're in hell
@earnest phoenix Sounds like unmaintainable code
Learn some design patterns
Not unmaintainable, just you need to understand it
my code is pretty idiot safe tbh, its quite hard to get it to error
He is on mobile dude...
why is that an issue?
You do realize how hard it's to code on mobile right
js is js regardless of your platform, that just shows you have less will to live than the rest of us if you code on mobile
No way to easily format it
Mobile doesn't have things like visual studio code to easily code and format everything
Re, (using discord.js)
I installed node.js on my VPS after that
I went to the directory of the bot and started with (node .) but when I close my ssh session the bot doesn't stay on.
can you help me ?
That pc does have, so what can i say than try before saying
Re, (using discord.js)
I installed node.js on my VPS after that
I went to the directory of the bot and started with (node .) but when I close my ssh session the bot doesn't stay on.
can you help me ?
@undone solar use a window manager like screen or tmux
@undone solar Maybe you did something that it closes the session when cutting out of it
You need a process manager like pm2 nodemon
@heavy anchor Thanks
I'm trying to make the BOT stay on even if my computer is turned off (sorry for the bad English)
love it when the easiest solution gets ignored lol
@undone solar use a window manager like screen or tmux
@earnest phoenix i need to pay settings on vps or i can just install it
they're just... packages
linux is open source there's nothing to pay
You don't buy node package manager packages
They're made for free
chances are your linux distro came with screen preinstalled
Will search how to (screen) my bot , thanks for answers guys 🙂
chances are your linux distro came with screen preinstalled
Ok doesn't have to install it
CTRL+A and D
will "minimize" or detatch the screen
here's the stupid bot i needed to parse the numbers for
One message removed from a suspended account.
There are a number of reasons the bot couldn't be able to ban someone. One is role hierarchy.
The code looks correct according to the docs and my eyes.
But the scoping is not so good
You should at least add brackets to indicate the start and end of your scope as your whitespace only makes it look like it's supposed to ban the message author for every message sent.
One message removed from a suspended account.
One message removed from a suspended account.
hey guys
how to fix this error
Error [TOKEN_INVALID]: An invalid token was provided.
at DiscordBot.login (C:\Users\User\Pictures\Oppa\discordBot\node_modules\discord.js\src\client\Client.js:205:52)
at Object.<anonymous> (C:\Users\User\Pictures\Oppa\discordBot\index.js:13:8)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
[Symbol(code)]: 'TOKEN_INVALID'
}
Found total 6 categories.
Found total 5 command(s) from Action.
Found total 1 command(s) from Developer.
Found total 3 command(s) from Fun.
Found total 2 command(s) from General.
Found total 7 command(s) from Image.
C:\Users\User\Pictures\Oppa\discordBot\node_modules\canvacord\src\Canvas.js:25
throw new Error(`The class ${this.constructor.name} may not be instantiated!`);
^
Error: The class Canvacord may not be instantiated!
at new Canvacord (C:\Users\User\Pictures\Oppa\discordBot\node_modules\canvacord\src\Canvas.js:25:15)
at Object.<anonymous> (C:\Users\User\Pictures\Oppa\discordBot\commands\Image\jail.js:3:16)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at C:\Users\User\Pictures\Oppa\discordBot\handler\module.js:30:22
at Array.forEach (<anonymous>)
??
Why wrong
nvm sorry
i put the token correctly
sorry sorry dude i thought another thing
ohh

if you're getting that error the token has to be invalid somehow
Arghhh headache coming
return channel.send(embedleave)
^
TypeError: Cannot read property 'send' of undefined```
that means channel is undefined
in that case, it means there was no channel found with that id
but sometimes it will send the message
can anyonw tell me how i would like tie a certain amount of credits to users
andi f they spend something they lose some credits
im not sure how i would go about it
on the occasions it does the channel has already been cached for whatever reason
#Trying to make a number guessing game
@bot.command()
async def guess(ctx, playerNumber = None):
if playerNumber is not None:
if math.isnan(playerNumber):
await ctx.send(f"The number {playerNumber} is not a number! Please guess a number 1-100")
else:
playerNumber = int(playerNumber)
computerNumber = random.randint(0, 100)
if playerNumber > 100:
await ctx.send(f"The number {playerNumber} is higher than 100! Please guess a number 1-100")
elif playerNumber < 1:
await ctx.send(f"The number {playerNumber} is lower than 1! Please guess a number 1-100")
else:
if playerNumber == computerNumber:
await ctx.send(f"Congratulations! You guessed the correct number , {computerNumber}!")
else:
await ctx.send("Sorry, you did NOT guess the correct number. Another day, friend :(")
else:
await ctx.send("Please submit a number 1-100!")
``` gives me the error "TypeError: must be a real number, not str"
Pretty pretty cool, Google
Just slap a database on it, and tweak the sensitivity a bit, and boom ready for production (probably w/o reactions)
Error [TOKEN_INVALID]: An invalid token was provided.
at DiscordBot.login (C:\Users\User\Pictures\Oppa\discordBot\node_modules\discord.js\src\client\Client.js:205:52)
at Object.<anonymous> (C:\Users\User\Pictures\Oppa\discordBot\index.js:13:8)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
[Symbol(code)]: 'TOKEN_INVALID'
}
Found total 6 categories.
Found total 5 command(s) from Action.
Found total 1 command(s) from Developer.
Found total 3 command(s) from Fun.
Found total 2 command(s) from General.
Found total 7 command(s) from Image.
C:\Users\User\Pictures\Oppa\discordBot\node_modules\canvacord\src\Canvas.js:25
throw new Error(`The class ${this.constructor.name} may not be instantiated!`);
^
Error: The class Canvacord may not be instantiated!
at new Canvacord (C:\Users\User\Pictures\Oppa\discordBot\node_modules\canvacord\src\Canvas.js:25:15)
at Object.<anonymous> (C:\Users\User\Pictures\Oppa\discordBot\commands\Image\jail.js:3:16)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at C:\Users\User\Pictures\Oppa\discordBot\handler\module.js:30:22
at Array.forEach (<anonymous>)
@clever vector go to the dev portal and regen the token and use it
How do i make a discord bot
shitpost somewhere else
I heard from someone that webhooks arent rate limited, is that true?
//#region Command handling
if (message.content.startsWith(process.env.PREFIX)) {
let reqCommand = message.content.split(process.env.PREFIX)[1];
switch(reqCommand) {
case 'karma': karmaCommand(message); break;
case 'help': helpCommand(message); break;
default: break;
}
}
//#endregion
I understand the switch/case meme now
what meme
I really need help
How do I remove all of a mentioned user's roles
This is in discord.py rewrite
so for example:
remove @mentioneduser
And all their roles should go away.
Help anyone?
Loop through the roles a user has a remove them
How do we find the user's roles?
@earnest phoenix
ahhhhhhhhhh pls help
Idk python
But get the guildmember
And it has toles property
Roles*
member.roles?
so something like this:
for remove in member.roles:
await member.remove_roles(remove)
I'm sure it's in the docs
ok
Yea
Something like that
ok
thanks
Np
Error:
const embed = new MessageEmbed()
^^^^^
SyntaxError: Unexpected token 'const'
[90m at wrapSafe (internal/modules/cjs/loader.js:1053:16)[39m
[90m at Module._compile (internal/modules/cjs/loader.js:1101:27)[39m
[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)[39m
[90m at Module.load (internal/modules/cjs/loader.js:985:32)[39m
[90m at Function.Module._load (internal/modules/cjs/loader.js:878:14)[39m
[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)[39m
[90m at internal/main/run_main_module.js:17:47[39m
i tried to make a messageembed, done but when i start it, the console logs that error
@frosty oriole Typically means a syntax error is on the line above/before it
If you get an error that says Unexpected token that means you have a syntax error somewhere
ok ty, its fixed
Since a "token" for a programming language is stuff like { } ; , etc
Basically the grammar
oh well anyways
how do people make bots that you can link accounts to using APIs?
i've been wanting to explore this idea for a bot but I don't know where to start
how would i attach like credits/currency to a user?
i dont know where i would start
look into databases
if you want to do sql, use sqlite for small scale, postgresql for large scale
if you don't, look into mongo or other nosql databases
k, those work with disc js im guessing
Yeah, they have libraries
k
Is it possible to change the bots avatar every 4 hours with code?
why would you want to do that
Will be cool
lol
as long as you're not verified, it's possible
Oh, my bot is on 20 servers. It will take a long time till I‘m verified. Any docs for it?
code: ```
//reactor
client.on('message', async message => {
const args = message.content.substring(PREFIX.length).split(" ")
const embedpermission = new Discord.MessageEmbed()
.setColor("BLUE")
.setAuthor(message.author.tag)
.setTitle("Unausreichende Berechtigung")
.setDescription(`Du bist nicht berechtigt, diesen Befehl auszuführen!`)
.setFooter("Mehr Infos dazu bekommst du im Support!")
if(message.content.startsWith(`${PREFIX}react`)) {
const messageiwannareact = await message.channel.messages.fetch(args[1])
if(message.author.bot) return
message.delete()
if(!message.member.hasPermission("ADMINISTRATOR")) return message.channel.send(embedpermission)
messageiwannareact.react(args[2])
}
}) ```
error: (node:19660) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Message at RequestHandler.execute (C:\Users\MAINFABIAN\Desktop\RayBotDP\node_modules\discord.js\src\rest\RequestHandler.js:170:25) at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:19660) 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:19660) [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.
Is the invite bot broken? Cause it won’t count the invites in my server any more
That‘s not Invite bot support :0
nevermind i was wrong, it's the username you can't change after being verified
library or raw api request?
Hmm
Okay, thanks.
client.user.setAvatar('imageurl');
``` that‘s easy
Just a timeout, random links, and done
let reactMessage = message
const filter = (reaction, user) => {
return reaction.emoji.name === '👍' && user.id === message.author.id;
};
reactMessage.react('👍')
reactMessage.awaitReactions(filter, {
max: 4,
time: 5000,
errors: ['time']
})
.then(collected => console.log(collected.size))
.catch(collected => {
console.log(`After a minute, only ${collected.size} out of 4 reacted.`);
});
i quite literally copy pasted this from discordjs.guide
and it doesnt work at all
I only changed the await reactions max/time thing
@earnest phoenix yea, uhh
you got a syntax error
Know I got a function error
client.once('ready', () => {
console.log('Ready!');
client.user.setActivity(`${prefix}help | ${client.guilds.cache.size} servers`, {
type: 'LISTENING'
});
var url = ["https://cdn.discordapp.com/avatars/610122588110192681/4b38ec582504b3efaa7b2bdedf7e3832.webp?size=512", "https://api.alexflipnote.dev/filter/blur?image=https://cdn.discordapp.com/avatars/610122588110192681/4b38ec582504b3efaa7b2bdedf7e3832.png?size=512"];
var urls = Math.floor(Math.random() * url.length);
client.user.setAvatar(url[urls], {
setTimeout( function () {
}, 10000);
})
});
@earnest phoenix, any idea?
uhh yeah
Hm, it‘s just for the random avatars
.setAvatar(url)
the settimeout literally does nothing in this case
You could make the url inside the set avatar a function to randomly pick one also
why are you doing this
Yeah that too
As test
isn't that api abuse
Why
If it‘s working
you get ratelimited for like couple of hours
Yeah
well i do for setname 😂
Yea
no stupid avatar
;-;
I deleted it. xD
It was kinda useless
yeah no changing your avatar that fast is probably
api abuse
doing x every y is usually api abuse
I‘ll set it on 4 hours later
ok
Hey Ehm- I’m new to the bots and all- but how can I upload my bot to the website
@thick gull DUDE NOT SO FAST!
^
Still fast
oh yeh
Yea
.
Can anyone explain simply what’s sharding
take a bowl and break it
you're left with shards of the bowl
splitting it into smaller pieces
@earnest phoenix
full screenshot please @fickle dune
why does it keep saying event loop is closed when i run my bot
python
do you get any other error logs?
ok
@earnest phoenix improper token has been passed
lol how
yeah how
like it doesn't work
like its missing something
or its invalid
its a bot token right @earnest phoenix ?
yes
kk
Me: do not turn on the bot it is in maintenance and might cause SHENANIGANS
Karens: well the developer said "If the bot is down goto repl.it and turn it on" so I'll turn it on
Me in the morning: The day is so cool!
Five minutes later
The welcome channel of my server: REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
I hate humans
Can someone fix this
const { MessageEmbed } = require("discord.js");
const got = require('got');
module.exports = {
name: "ban",
category: "Moderation",
description: "Ban Cmd!",
execute(message) {
if (!msg.mentions.users.size) {
return msg.reply('you need to tag a user in order to ban them!');
}
if (!msg.member.hasPermission("BAN_MEMBERS")) return;
var member = msg.mentions.members.first();
member.ban().then((member) => {
msg.channel.send(random(success) + member.displayName + " has been banned");
});
},
};```
what wrong
@eager granite we won't spoonfeed
we won't just sit and fix your code. we can help with some stuff
what error
but we won't just give you fixed code
@earnest phoenix We dont mini mod
ReferenceError: msg is not defined
at Object.execute (/home/container/commands/ban.js:10:9)
at Client.<anonymous> (/home/container/index.js:78:13)
at Client.emit (events.js:315:20)
at MessageCreateAction.handle (/home/container/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (/home/container/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
at WebSocketShard.onPacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
at WebSocket.onMessage (/home/container/node_modules/ws/lib/event-target.js:125:16)
at WebSocket.emit (events.js:315:20)
Lmao
You haven't defined msg.
bruh
ty
@earnest phoenix We dont mini mod
@eager granite that isn't minimodding
its literally telling you that we won't spoonfeed
ty
@eager granite the hell
when you copy paste code
ikr
I upload my bot.js
pls fix it

I upload my token.json pls fix it
i hate to spoonfeed and if they beg i link them my bot's open source code XD
I upload my token.json pls fix it
@thick gull
{
"t":"first 5 letters",
"o":"second 5",
"k":"third 5",
"e":"fourth 5",
"n":"the rest"
}
const token = config.t + config.o + config.k + config.e + config.n
or make a for loop
no

lol
.
this is how i store tokens:
-dotpost
process.env.TOKEN;
wait fuck this isn’t shitpost
I've got a whole 100+ lines of code which is my template for creating userData objects and inserting them to my mongodb collections
So I store my data into json files by guild, channel, member, user, and role. Since my commands are asynchronous and sometimes they do fast tasks in between loading and saving the data, does this mean that if two commands were run extremely quickly, one might overwrite the other's changes?
I suggest mongodb;)
Which is JSON
it does not overwrite itself and corrupt
because its a proper db
and quite simple to use once you get the basic
uh a json file is very different from a json db
no @fluid basin you can easily see that the person is using json files as a database.
that won't be called a database
they are using it as a database
it will just be persistent storage
yes but they are using it as a database
ok lemme rephrase that
please do
json file is not the same as json file db nor a json-like db
I'll switch to MySQL, since I was hacking together a relational structure with JSON anyway
The painful part is going to be changing the 40 files of my bot to use MySQL instead of JSON
just use mongodb lol
No
There is no data
And I need the ability to store keys with . and $ so MongoDB isn't for me
bruh
bru h
and _dot_
objects have joined the chat
objects with $ or . in mongodb cause errors...
let object = {foo:"bar", a: "b"}
object.a // returns b
object.foo // returns bar
``` iirc
wait is there a specific reason why??
yes and table.find({$foo:"bar",".a":"b"}) throws an error
What kind
And I need the ability to store keys with
.and$so MongoDB isn't for me
no I mean this
What's wrong with MySQL though? It's a standard database with asynchronous support and an advance query language that suits every need I have for the bot
iirc its quite slow
MySQL isnt slow
Might as well go PostgreSQL
Can I use them interchangably
i mean if you can secure it properly 
It's SQL so probably won't be too much of a hassle when compared to NoSQL -> SQL
well design wise it rather counter intuitive to set column/key names to variable data
unless you tell me that you are going to "ALTER TABLE embeds RENAME COLUMN "my embed" TO "wtf"
lol
yeah thats the same case for mongo wtf
no
objects can be put in documents you know
yes i know
I mean, embed JSON that you can send to Discord will certainly be supported by MongoDB since there's no special characters in document keys
also @fluid basin did you forget a comma in that object
¯_(ツ)_/¯
i could just SELECT * FROM \embeds` WHERE `guild` = ? AND `channel` = ?and have thetemplate` column be a JSON string
too lazy to fix the formatting
bruh pls no
@lean mirage
json in sql is dumb
i dont know much about sql but storing json seems dumb
mongo's probably better for storing json data
sql is for normalised data
But first one
Can I store a key named $set inside of an object inside of a document
and have it not set anything
you can set it as null
so if I have a json following the embed json format, if I do message.channel.send(require(path.to/json)) will it send the embed?

not what im asking
yes it would
wouldn't the json need to be exported?
no
doubt it but
The embed is sent in the request body, right?
ELI5
what?
new question
how would mongodb solve my problem
the one i asked that everyone ignored
lol
Since my commands are asynchronous and sometimes they do fast tasks in between loading and saving the data, does this mean that if two commands were run extremely quickly, one might overwrite the other's changes?
@dusk vault
ill give an example
const data = (load guild document)
// do something with data
await someShortAsyncTask();
// do something with data
(save guild document)```
In MongoDB, a write operation is atomic on the level of a single document, even if the operation modifies multiple embedded documents within a single document.
and two of these get run at the same time
ik
but how do i fix it
is my question
i dont want random overwrites
that break commands
mongodb has queue iirc
wouldnt help
i mean most good db shouldn't just overwrite randomly
queue wouldnt fix me saving old data
yes i did
oops wrong channel
mb
👀
maintain a shared state
say like
instead of reading it
maintain a shared state
@fluid basin
wdym
keep it in memory you mean?
lets say there's 10GB worth of guild data for my bot and the vps has 4GB of memory

point is
yea how
Hey guys i have a question
then time™️ to™️ upgrade™️ your™️ vps™️ ™️
I haVe A Question
shoot
if you're updating it frequently, I don't see why not to keep it in memory
Yall got Developer Mode? Like when you can see the users id?
bruh
we do
U do?
yes
O ok
ok but
lol you do know a few K to 10GB is more than 10000000x






