#development
1 messages · Page 1226 of 1
._.
const snipes = db.get(message.channel.id) || [];
const msg = snipes[args[0]-1||0]```
bruh
hmm
no idea
but u should save in cache
cuz that makes ur database bigger
and those delete message are useless to save in database
I saved it in the cache, but the snipes are deleted when the bot is closed.
save them in a database
I do not know how to do it
they're built to hold large amounts of data
there's tons of guides online on how to set one up
is there an event that emits when a user mutes/unmutes their mic
just make a command that it saves all cache when u going to turn off ur bot
I made a lyrics command
any one know how to snipe titles for lyrics-finder npm package
??
thank you
any one know how to snipe titles for lyrics-finder npm package
@ancient nova
https://gyazo.com/e4dabeefbb2c73a3d380951e2256ea94
vote which layout you like better 1 or 2
Please and thank you ❤️
i use layout 2
alright thank you
layout two def!
what can I help you with?
I have a question
Don't Just Say "Hello" in Chat.
the auctions program
Ye
then that's that?
Ye
theres your answer xD
shiv u seen nothing
I thought I needed to join a program xD
You applied for our auctions feature and will get a message if your application is approved
But it's completely optional so if you don't want to bid, don't sweat it
Mk
There's NO ETA ON AUCTION APP
Cy
;-;
Forgot to change casing
Ok.....
I sent an application probably more than three months ago and I never heard anything LOL
argh fucking keyboard is longer than usual
It was probably denied then @heavy anchor
You don't get a message if it's denied
Oh ok
oh ok I probably didn't put enough money LOL
What's the question
hello
I want to delete Woof Woof as it is a loading message whilst the bot is getting the avatar
uhmm
but i dont believe that is working. is there any way to do it?
When do you want to delete it?
message.channel.send("woof woof").then((m) => {
//embed
m.delete()
}
@sweet ruin ^^
Not really
jk
py has a more strict syntax than js imo
i dont understand why ppl use _
js is nothing like py
Because it says "I don't want to use this var"
all things ik about Py is print()
for exmaple the for() loop is same same somewhere
I don't remember the exact name for it but _ is used as function argument whenever you get something you don't want
and the if()
In Python you have to create an iterable object and iterate over it
range() does that
a = 10 ?
literally just-yeah
Yes, Python is weak/dynamic typing
So it doesn't have types attached to variables
Yeah
//C++
int a = 0;
float b = 0.1;
//Js
var a = 0, b = 0.1;
//Py
a = 0;
b = 0.1;
xD
let num: i32 = 5;```
is that PY ?
no
rust
hey cry
I'd say it's definitely worth it.
I haven't used it for anything major yet, but when I do, I'd like to write it in Rust. It's not very much in demand though as it's quite a young language, but it's growing quickly.
folder.filename
like my code is hella buggt
any ideas why?
it like takes long to send messages
client.load_extension('cogs.music')
Blocking functions
How do I search for my BOT to search for songs to play
something like this for example?
Instead of being by URL
Blocking functions
@slender thistle maybe...
what are blocking things?
bytesio?
"https://api.spotify.com/v1/tracks/19jWzFkYj7g5dKEKpdm2eM" -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer [TOKEN]"
let spotifyapi = `https://api.spotify.com/v1/tracks/${activity.syncID}`;
How can I connect the upper one with the one below?
to get oauth
I'm having an issue where I keep getting the handle promise rejection because I don't have perms, the perms isn't the issue, I just need help on how to catch the warning, any help would be great
.avatar_url)```
client.on('message', async (message) => {
if(message.content == "kickme") {
try {
await message.member.kick()
} catch (err) {
message.reply("ERROR")
}
}
})
``` is a bad example :)
.avatar_url)```
@drifting wedge its giving me erros
I'm having an issue where I keep getting the handle promise rejection because I don't have perms, the perms isn't the issue, I just need help on how to catch the warning, any help would be great
@analog walrus you need to handle the promise. You usually handle them with.catch(...)or try & catch with async/await.
@drifting wedge USE AIOHTTP INSTEAD OF REQUESTS
@drifting wedge USE AIOHTTP INSTEAD OF REQUESTS
@slender thistle ok and what else?
send request to str(member.avatar_url)
Stop using requests
Start using aiohttp
When sending a GET request, the URL will be str(member.avatar_url)
@sudden geyser if would catch still function properly if I left it empty?
wdym
does there need to be something in .catch( "here" ) or can it be empty?
ah, yes
It takes a function with a parameter that'll be the error.
So for example:
reject(new Error("This is an error")).catch((err) => console.log(err)) // "This is an error"```
okay sweet, thanks
0Exe do you know what aiohttp is
Yes, and it's recommended because requests is sync while aiohttp is async I believe.
But for your problem
member.avatar_url returns an Asset
You need to get the URL to the image.
If you use the str() constructor on it, you'll get the URL representation.
So, str(member.avatar_url)
try it and see
I don't know what that is.
so you didn't define it.
define member as what it should be or use what's appropriate, as it looks like it should be a guild member.
message author
but ok
requests not defined
should I add request =?
or aiohttp
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Guild' object has no attribute 'member'
fetch(`https://api.spotify.com/v1/tracks/${activity.syncID}`, {
headers: {
'Accept': `application/json`,
'Content-Type': `application/json`,
'Authorization': `Bearer TOKEN-HERE`
}
}).then(body => {
if(body.error.status === 400) return message.channel.send(`**${message.author.tag}**: Şarkı bulunamadı..`);
is not it right?
console.log(body) gives ridiculous reactions.. https://hastebin.com/lopofisema.css
@sudden geyser can u help me?
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Guild' object has no attribute 'member'
thats the rror im getting
url = str(ctx.guild.member.avatar_url)
not working.
I can not get a body
if I think everything is true.
fetch(`https://api.spotify.com/v1/tracks/${activity.syncID}`, { headers: { 'Accept': `application/json`, 'Content-Type': `application/json`, 'Authorization': `Bearer TOKEN-HERE` } }).then(body => { if(body.error.status === 400) return message.channel.send(`**${message.author.tag}**: Şarkı bulunamadı..`);is not it right?
@earnest phoenix
TypeError: Cannot read property 'status' of undefined
but
body.error.status === 400
How can I combine the spotify api address with auth.
my code is correct
to take auth
wut does blocking mean?
is this correct?
yes
yes
ye i know
Hey guys, im working on a command that mutes all users in the chat you are, but im missing some code that idk how to make, may someone help me with it?
var user = message.member.voice.channel
if (message.member.voice.channel) {
(here is the missing code)
} else { message.reply('You need to join a voice channel first!'); }
break; ```
i tried things like ```user.voice.serverMute(true)```
didnt made it work
No it wont lol
Check the docs..?
It's probably on the docs
yea
^
Check voice.channel
i tried docs but i didnt found anything usefull
channel.voice
i know channel is a feature of user
Its VoiceState.setMute()
nice
Tim with the accurate Google
pog
Literally just checked the docs lol
will try it, if i make it work u will know
Tim the DJS doc
Lul
Voice channels have a members property
at least i got this boi workin
lol
wait what
fetch(`https://api.spotify.com/v1/tracks/${activity.syncID}?market=ES`, {
headers: {
'Accept': `application/json`,
'Content-Type': `application/json`,
'Authorization': `Bearer BQBbGJRYRhrerjRvZlpwg9B71QZEBI-OlFvHgvhkwRnIbemG3eyG25JtzKR6nCBU1RKQLejnZBjVoWtQcP_XPFdU5Ya4bRIoL9ghmk7y9bZ0jeJXlDHiHO1a985Z2DEKjHjluaYWyNeWChwSxDjERsJJvJWydfRHZfvI98EP3nySYYxg8DhlT9riuGsq6kYyDZJBk95lzG1POo1j5SXD7acWjcFj1SoqlmfgGRoMqr3oRhFp1s9KGP7SCNkbA2Qbx91GMai62GP2sNy3tLeTpicrtiIKkFkW`
}
}).then(body => {
//if(body.response.error.status === 400) return message.channel.send(`**${message.author.tag}**: Şarkı bulunamadı..`);
guys what's wrong here.
body should be like this: https://hastebin.com/uqirimidib.json
but such
// ==UserScript==
// @name Phishing Blockz
// @namespace http://use.i.E.your.homepage/
// @version 0.1
// @description Phishing block based on hyperlinks
// @include *
// @run-at document-end
// ==/UserScript==
// ==UserScript==
// @name Discord Custom CSS
// @version 1.4
// @author OleVik
// @match https://*/*
(function name() {
'use strict';
setTimeout(() => {
let test = Array.from(document.querySelectorAll('span'));
test.map(m => (m.textContent=="davon")?m.setAttribute("style" "background-color: gold"):null);
}, 5000);
window.onload = setTimeout(name, 5000);
})();
Can I replace style with an extern file, where my css goes?
Is that
@earnest phoenix if youre expecting a json response, you need to tell fetch to return json data
result = await fetch(url).then(response => response.json())
But .then() as well ehHGgH I mean uHhHHH I mean sUuuURE
Look at what I haven't seen in 10 minutes 
{ errors: [ { domain: 'youtube.quota', reason: 'quotaExceeded', message: 'The request cannot be completed because you have exceeded your quota.' } ], code: 403, message: 'The request cannot be completed because you have exceeded your quota.' }
help
it doesnt matter, you can do .then().then() or a = await fetch(); b = await a.json()
Tim, can't tell but is that ratelimited?
That is youtube rate limits yes
Also ik I just don't like mixing .then() and async stuff for some reason, it feels clunk
{ errors: [ { domain: 'youtube.quota', reason: 'quotaExceeded', message: 'The request cannot be completed because you have exceeded your quota.' } ], code: 403, message: 'The request cannot be completed because you have exceeded your quota.' }
pls
will it last or do I have to make new api key?
Just wait
alright
I get you, but in this case its good because you just await a single thing instead of using multiple await lines for the same thing
Who knows lmao
Its VoiceState.setMute()
@quartz kindle
Cannot read property 'setMute' of undefined
VoiceState is the class name
You need to define a voicestate
You get a VoiceState instance from member.voice
therefore the actual code should look like this: member.voice.setMute()
Also, the setMute function requires a boolean argument
if (message.member.voice.channel) {
user.VoiceState.setMute(true)
You need to explicitly say if yoi want mute to be true or false
In this case it'd be message.member.voice.setMute(true)
i misscoded R)
And you will need to do this for every single user you want to mute
There is no other way to mute all
I mean you could push them all into an array then use a forEach loop
Thats what i meant
wut does blocking mean?
It depends
it means life is bad
Blocking code means code that makes your entire program freeze until it finished
Ouchy
and how do i pick them all?
Its literally blocking the program from processing other things while it waits for a specific thing
Its literally blocking the program from processing other things while it waits for a specific thing
@quartz kindle ok... um is aiohttp blocking?
url = str(ctx.guild.member.avatar_url)
would this work?
im changinfg from requests to aiohttp
for mi avatar command i use this
Async means that the task is performed asynchronously, which means its not synchronized with the main program, meaning the main program can continue processing stuff while the async task is waiting
var user = message.mentions.users.first();
message.channel.send(user.avatarURL());
break;
var user = message.mentions.users.first(); message.channel.send(user.avatarURL()); break;
@dreamy thistle async?
@dreamy thistle reccomend not using var it's kinda decapricated and stinky
that sends the mentioned user avatar
why is [![]] False but [!+[]] True?
if my calculations are correct, [] is truthy, [] as a number (+[]) is 0 and 0 is falsey
Makes sense
Now why is +[] 0 lmao
Empty array no values
Would make more sense if it were nan
Exactly lmao
Strange
Just js quirks
@drifting wedge https://tryitands.ee
it doesnt
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'member' is not defined
thats the error
newbie ask: how do you make guild-custom prefixes
newbie ask: how do you make guild-custom prefixes
@dreamy thistle with json?
In this video, we learn how to make a system allowing for custom prefixes in multiple servers.
If you have any suggestions for future videos, leave it in the comments below.
GITHUB: https://github.com/Rapptz/discord.py
DOCUMENTATION: https://discordpy.readthedocs.io/en/lates...
if so there ya go
ay i got this too work
Fuck?
yes
url = str(ctx.guild.member.avatar_url)
this says member not defined
its in a command
so can i do ctx.message.author?
i am no expert on that
Now why is +[] 0 lmao
apparently js converts an array into a string, then into a number
so +[6] === "6" === 6
and +[1,2,3] === "1,2,3" === NaN
:o epic
Make a command that reqires the user to mention a channel
Then in that comman use message.mentions.channels to access this mention
Then get the channel id from it
Then store the id in the db
how can i make the welcome card like alighn text in a box
like center, left, right etc
using pillow and python
https://stackoverflow.com/questions/1970807/center-middle-align-text-with-pil I found this on stack because I don't know py. Feel free to take reference from it :D @drifting wedge
0, what you want to do is halve the values of the axis you want to center on
So if i had a box of 100 by 100, I'd center stuff by:
box height / 2 for center alignment along the Y axis
box width / 2 for center alignment along the x axis
Drawing libraries dont have the concept of centering or aligning
They only understand coordinates
You need to implement any centering or aligning logic yourself, using math
Because there are no established "elements" like in markup
which is the best way? with command handler or without command handler and why?
Definitely with
and why?
perfect, thanks for the answer.
how to delay sending a message with discord js
how do I get an sql database
apt install mysql-server
"artists": [
{
"external_urls": {
"spotify": "https://open.spotify.com/artist/4Fn5clYETVpCxnIcFSZhr9"
},
"href": "https://api.spotify.com/v1/artists/4Fn5clYETVpCxnIcFSZhr9",
"id": "4Fn5clYETVpCxnIcFSZhr9",
"name": "Massaka",
"type": "artist",
"uri": "spotify:artist:4Fn5clYETVpCxnIcFSZhr9"
},
{
"external_urls": {
"spotify": "https://open.spotify.com/artist/2u4xMsh0M2B7R8Wb3pEWae"
},
"href": "https://api.spotify.com/v1/artists/2u4xMsh0M2B7R8Wb3pEWae",
"id": "2u4xMsh0M2B7R8Wb3pEWae",
"name": "Anıl Piyancı",
"type": "artist",
"uri": "spotify:artist:2u4xMsh0M2B7R8Wb3pEWae"
},
{
"external_urls": {
"spotify": "https://open.spotify.com/artist/5rBUMBV7L6zPsEKnlgiOm9"
},
"href": "https://api.spotify.com/v1/artists/5rBUMBV7L6zPsEKnlgiOm9",
"id": "5rBUMBV7L6zPsEKnlgiOm9",
"name": "Yener Çevik",
"type": "artist",
"uri": "spotify:artist:5rBUMBV7L6zPsEKnlgiOm9"
},
{
"external_urls": {
"spotify": "https://open.spotify.com/artist/3yzGegJHrOW1CndMVFoo3m"
},
"href": "https://api.spotify.com/v1/artists/3yzGegJHrOW1CndMVFoo3m",
"id": "3yzGegJHrOW1CndMVFoo3m",
"name": "Hidra",
"type": "artist",
"uri": "spotify:artist:3yzGegJHrOW1CndMVFoo3m"
}],
how can I get all the artists. object
sounds easy enough
@white vapor use setTimeout()
sounds easy enough
@torn ravine actually:
apt install mysql-server mysql-client
thanks
@earnest phoenix error first questions later
not sure if the client gets installed automatically
Why not use phpmyadmin hajajajajahajaj
@torn ravine entirely up to you
I don't know the pros and cons
I just know that both are good
definitely postgres
It is. You have to use mysql now, better anyway
import time
from discord.ext import commands,tasks
client = commands.Bot(command_prefix = 'eh!')
client.remove_command('help')
@client.event
async def on_ready():
print('Bot is ready!')
await client.change_presence(status=discord.Status.online,activity=discord.Game('COMING SOON | eh!help'))
@client.command()
async def help(ctx):
embed = discord.Embed(
title = '**EasyHost Help Panel**',
description = '',
colour = discord.Colour.blue(),
)
embed.add_field(name='eh!help',value='Shows this help panel."',inline=True)
embed.add_field(name='eh!ping',value='Returns the ping of the bot."',inline=True)
embed.add_field(name='eh!website',value='Gives you the link to the website."',inline=True)
embed.add_field(name='eh!invite',value='Sends you a link to invite this bot..',inline=True)
embed.add_field(name='eh!discord',value='Sends the invite to the support server.',inline=True)
embed.add_field(name='eh!support',value='Returns a link to support us!',inline=True)
embed.set_thumbnail(url='https://cdn.discordapp.com/attachments/751978117156962426/751978146299117669/EasyHosting.png')
await ctx.send(embed=embed)
@client.command()
async def ping(ctx):
await ctx.send(f'Pong! {round(client.latency * 1000)}ms')
@client.command()
async def website(ctx):
await ctx.send('Website: <https://easyhosting.gq>')
@client.command()
async def invite(ctx):
await ctx.send('Invite the Bot: <https://invite.easyhosting.gq>')
@client.command()
async def discord(ctx):
await ctx.send('Discord: <https://discord.easyhosting.gq>')
@client.command()
async def support(ctx):
await ctx.send('Support Us: <https://support.easyhosting.gq>')
client.run('NzUxNjI5ODU1Njg2MjYyODM0.X1L32g.MT6TELPGvo02c7lC8-g2BrkX5Ls')``` how come it doesnt work for status or eh!help?
Nice token bro
@indigo flax You should delete that or reset your token, yes
Reset your token first
10k servers you say
Then we may be able to help you
😏
1k*
@pure lion centering is even wose than that in PIL if you want it actually centered
import time
from discord.ext import commands,tasks
client = commands.Bot(command_prefix = 'eh!')
client.remove_command('help')
@client.event
async def on_ready():
print('Bot is ready!')
await client.change_presence(status=discord.Status.online,activity=discord.Game('COMING SOON | eh!help'))
@client.command()
async def help(ctx):
embed = discord.Embed(
title = '**EasyHost Help Panel**',
description = '',
colour = discord.Colour.blue(),
)
embed.add_field(name='eh!help',value='Shows this help panel."',inline=True)
embed.add_field(name='eh!ping',value='Returns the ping of the bot."',inline=True)
embed.add_field(name='eh!website',value='Gives you the link to the website."',inline=True)
embed.add_field(name='eh!invite',value='Sends you a link to invite this bot..',inline=True)
embed.add_field(name='eh!discord',value='Sends the invite to the support server.',inline=True)
embed.add_field(name='eh!support',value='Returns a link to support us!',inline=True)
embed.set_thumbnail(url='https://cdn.discordapp.com/attachments/751978117156962426/751978146299117669/EasyHosting.png')
await ctx.send(embed=embed)
@client.command()
async def ping(ctx):
await ctx.send(f'Pong! {round(client.latency * 1000)}ms')
@client.command()
async def website(ctx):
await ctx.send('Website: <https://easyhosting.gq>')
@client.command()
async def invite(ctx):
await ctx.send('Invite the Bot: <https://invite.easyhosting.gq>')
@client.command()
async def discord(ctx):
await ctx.send('Discord: <https://discord.easyhosting.gq>')
@client.command()
async def support(ctx):
await ctx.send('Support Us: <https://support.easyhosting.gq>')
client.run('NzUxNjI5ODU1Njg2MjYyODM0.X1L32g.MT6TELPGvo02c7lC8-g2BrkX5Ls')```
any reason why
dude
@placid iron don't know PY, don't know pillow

What is the error
to see if it works
Oh my god
@indigo flax How about some errors
they're intentionally leaking it because they reset it

lol
@pure lion well its a good start tbh and it works but for me i needed to get the size not including margins things around the text
Ignoring exception in on_ready
Traceback (most recent call last):
File "/home/container/.local/lib/python3.8/site-packages/discord/client.py", line 312, in _run_event
await coro(*args, **kwargs)
File "bot.py", line 11, in on_ready
await client.change_presence(status=discord.Status.online,activity=discord.Game('COMING SOON | eh!help'))
AttributeError: 'Command' object has no attribute 'Status'
dude gonna get his server nuked :(
@placid iron ah that ought to be a bitch
noice
gg
ok first off
I hope your bot has 0 servers now :3
eh!help wont work
the status wont work too
Ignoring exception in on_ready
Traceback (most recent call last):
File "/home/container/.local/lib/python3.8/site-packages/discord/client.py", line 312, in _run_event
await coro(*args, **kwargs)
File "bot.py", line 11, in on_ready
await client.change_presence(status=discord.Status.online,activity=discord.Game('COMING SOON | eh!help'))
AttributeError: 'Command' object has no attribute 'Status'
when i do eh!help it says Ignoring exception in command help: Traceback (most recent call last): File "/home/container/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped ret = await coro(*args, **kwargs) File "bot.py", line 15, in help embed = discord.Embed( AttributeError: 'Command' object has no attribute 'Embed' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/container/.local/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 903, in invoke await ctx.command.invoke(ctx) File "/home/container/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 855, in invoke await injected(*ctx.args, **ctx.kwargs) File "/home/container/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped raise CommandInvokeError(exc) from exc discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Command' object has no attribute 'Embed'
btw its discord.py
ok let me read your code
How do you get a random user from a d.js reaction collector?
On the end event, i've tried to do collected.random()
But I don't know how to get to the user object
collector.on('end', collected => {
console.log(collected.random());
});
@earnest phoenix what does it log?
@indigo flax for some reason or somehow you are setting discord to be a command which is messing everything up
Please bin
@placid iron where?
it should work if you werent doing that - but i cant find where its happening
import time
from discord.ext import commands,tasks
client = commands.Bot(command_prefix = 'eh!')
client.remove_command('help')
@client.event
async def on_ready():
print('Bot is ready!')
await client.change_presence(status=discord.Status.online,activity=discord.Game('COMING SOON | eh!help'))
@client.command()
async def help(ctx):
embed = discord.Embed(
title = '**EasyHost Help Panel**',
description = '',
colour = discord.Colour.blue(),
)
embed.add_field(name='eh!help',value='Shows this help panel."',inline=True)
embed.add_field(name='eh!ping',value='Returns the ping of the bot."',inline=True)
embed.add_field(name='eh!website',value='Gives you the link to the website."',inline=True)
embed.add_field(name='eh!invite',value='Sends you a link to invite this bot..',inline=True)
embed.add_field(name='eh!discord',value='Sends the invite to the support server.',inline=True)
embed.add_field(name='eh!support',value='Returns a link to support us!',inline=True)
embed.set_thumbnail(url='https://cdn.discordapp.com/attachments/751978117156962426/751978146299117669/EasyHosting.png')
await ctx.send(embed=embed)
@client.command()
async def ping(ctx):
await ctx.send(f'Pong! {round(client.latency * 1000)}ms')
@client.command()
async def website(ctx):
await ctx.send('Website: <https://easyhosting.gq>')
@client.command()
async def invite(ctx):
await ctx.send('Invite the Bot: <https://invite.easyhosting.gq>')
@client.command()
async def discord(ctx):
await ctx.send('Discord: <https://discord.easyhosting.gq>')
@client.command()
async def support(ctx):
await ctx.send('Support Us: <https://support.easyhosting.gq>')
client.run('nou')```
@pure lion https://pastebin.com/EnkULx4t
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
@placid iron code above
I'm trying to get the ID of a random user
collected.random().id
it returns undefined @pure lion
@indigo flax ah i see
Oh it gets a message
and it overwrites discord
collected.random().message.author.id OR collected.random().author.id
ok
jeejee
if i comment the status thign
ill fix the status thing now
so like
@pure lion That just gets the ID of the author of the message, i'm trying to pick a random user from a reaction
thx
btw when a bot logs in it automatically goes online so you dont need to set status = online
@earnest phoenix then remove id
bruh
ok
ok
@dreamy thistle with json?
@drifting wedge #development message
please don’t tell newbies to start with json databases 😩
XD its fine
ok
you can always give it to me
Or me
shmile;]

@drifting wedge #development message
please don’t tell newbies to start with json databases 😩
@thick gull i was just asking
not saying he should
you linked him a json video..?
well yes, fair good point
@dreamy thistle dont use json
use like mongo or seomthing similar
Ggggg:)))
how do u get shards
Nono
Me: yay 2500
Dank memer, mee6: 
@green kestrel how do i get shards like urs
@green kestrel they are much bigger and stupider bots, do not compare yourself >:((((
A shard count in your presence?
Or just how to enable shards
ignore the uptime thing
every 24 hours
it adds 1 to days
but doesnt remove the hour thing
idk how to fix it
Yeah I always run my bots on multiple shards from the first server
im not good with sharding
But depending on what language you use that isn't a good idea
-shards
You can shard without having like 1000servers minimum?
Yes
mhmm interesting
Sporks has ten shards
but yeah if i shard
Doesn't need to shard yet. Just below 2300 servers
Depends, discord.js?
yes
but i want discord.py too
on discord.js
i saw them say like
go to package.json
and than change
main file to shards.js
and chaine node.js to shards.js
There's two ways to do it
Either each shard as a process or each shard as a connection in the same node process
also thanks for telling me so far :)
No problem
can u shard on discord.py lol
Bear in mind I don't use discord.js or even JavaScript so my advice may be spotty in places
Yes I think so @indigo flax
also my friend's bot is in like 3k servers
and like
he said he keeps getting rate limited
cause hes only using 1 shard
You have to shard to connect more than 2500
Or discord rejects your websocket connection
can anyone help me please, I need to make sub folders work with my command handler.
---> Current Code
const fs = require('fs');
client.commands = new Discord.Collection();
const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
client.commands.set(command.name, command);
}
Can't you change the second to last line to be like require (./commands/${file}/index.js) or such
how do i shard on discord.py
And take the endswith off
Instead checking if is directory
@indigo flax not sure on that one, someone here will know though
It's worth knowing how to shard, way before you need it
Because if your bot suddenly grows and you don't have sharding support your growth can be kneecapped really quick
can anyone help me please, I need to make sub folders work with my command handler.
---> Current Code
const fs = require('fs'); client.commands = new Discord.Collection(); const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js')); for (const file of commandFiles) { const command = require(`./commands/${file}`); client.commands.set(command.name, command); }
@leaden shoal
i think you can enable withFileTypes in options, it will return Dirent objects instead
then you can just call isDirectory() on the Dirent object
if it is, loop through that directory too
can you give me a example please
you don't need an example for that
it's just passing options
to save yourself some pain you can create a function that reads contents of a directory
then you can just recursively call it inside of itself if Dirent#isDirectory returns true
Im sorry but I think I am just kinda dumb at this time because I have no idea what you mean, but thanks for the help
how can i make my webhook send messages on the channel?
@earnest phoenix Hey sorry to bother you but I didnt really understand what you was saying in the discord. By any chance at all could you just write the code for me if possible
const fs = require('fs');
client.commands = new Discord.Collection();
const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(./commands/${file});
client.commands.set(command.name, command);
}
Please I really need this to continue with my bot but I do understand if not
@compact notch what you mean
you need to get the webhook from a channel not just the main server
and ok thanks for the help anyway @earnest phoenix
ok
attempt to do it yourself
I am and have
ok thanks 💯
does anyone use quick.db
a lot
how can i make a webhook send a message?
I wanna connect my google cloud sql to quiickdb
oh boy...
maybe use mongodb
do you have a suggestion for a better wrapper?
there aren't many really, closest I really saw was a mysql wrapper for keyv
it's a key value json
hm.
be aware the owner no longer maintains it
mysql/mariadb drivers should work with Google cloud sql server
thanks speedy
so, why isnt my webhook working?
how can i measure the xp nesessary for the next level?
it says
You don't use discord webhooks for voting. You use your own webhook service.
You have to provide your own service for retrieving and sending. All you do is access our API.
how do I make this into a function please
TypeError: member.guild.channels.find is not a function
thats the error code I get ^^
If you're using v12, it's channels.cache.find(channel => ...)
Channels is the ChannelManager, cache would access the collection of channels.
ok I am thanks but where do I put that please or does it not matter
Show me your code.
if i install a module off gh do i ref it by the username and repo name
ie.
thattonybo/store on github
do i require('thattonybo/store') or require('store')
No, you silly goose. It's member.guild.channels.cache.find(channel => ...)
I never told you to erase everything before that.
is this correct
url = str(ctx.message.author.avatar_url)?
its giving me erors
member not found
Canvas context does not discord.js objects and properties.
Canvas context does not discord.js objects and properties.
@drowsy sentinel me?
im using pillow
You have to provide your own service for retrieving and sending. All you do is access our API.
@drowsy sentinel how can i access the API
By setting up a webhook service and putting it in the webhook section under your bot's page in the editing page.
@drifting wedge message.author is pointing to a user object. Which means it has .displayAvatarURL() method.
const url = message.author.displayAvatarURL();
@compact notch That's on you. I cannot help you with that. Read our docs and look into making your own web service for handling webhooks.
You can look into using https://github.com/Deivu/Haruna
const url = message.author.displayAvatarURL();
@drowsy sentinel im using d.py
isnt this d.js
how do I get all body.artists.name values?
"artists": [
{
"external_urls": {
"spotify": "https://open.spotify.com/artist/4Fn5clYETVpCxnIcFSZhr9"
},
"href": "https://api.spotify.com/v1/artists/4Fn5clYETVpCxnIcFSZhr9",
"id": "4Fn5clYETVpCxnIcFSZhr9",
"name": "Massaka",
"type": "artist",
"uri": "spotify:artist:4Fn5clYETVpCxnIcFSZhr9"
},
{
"external_urls": {
"spotify": "https://open.spotify.com/artist/2u4xMsh0M2B7R8Wb3pEWae"
},
"href": "https://api.spotify.com/v1/artists/2u4xMsh0M2B7R8Wb3pEWae",
"id": "2u4xMsh0M2B7R8Wb3pEWae",
"name": "Anıl Piyancı",
"type": "artist",
"uri": "spotify:artist:2u4xMsh0M2B7R8Wb3pEWae"
},
{
"external_urls": {
"spotify": "https://open.spotify.com/artist/5rBUMBV7L6zPsEKnlgiOm9"
},
"href": "https://api.spotify.com/v1/artists/5rBUMBV7L6zPsEKnlgiOm9",
"id": "5rBUMBV7L6zPsEKnlgiOm9",
"name": "Yener Çevik",
"type": "artist",
"uri": "spotify:artist:5rBUMBV7L6zPsEKnlgiOm9"
},
{
"external_urls": {
"spotify": "https://open.spotify.com/artist/3yzGegJHrOW1CndMVFoo3m"
},
"href": "https://api.spotify.com/v1/artists/3yzGegJHrOW1CndMVFoo3m",
"id": "3yzGegJHrOW1CndMVFoo3m",
"name": "Hidra",
"type": "artist",
"uri": "spotify:artist:3yzGegJHrOW1CndMVFoo3m"
}]
can anyone help me with sub folder command handling please
yeah
iterate over it using a for loop or forEach
array
for each iteration you just need to return the artist name
hey
me have question about pillow
i know this cneter aligns text
but can i like align text to the right?
@valid frigate TypeError: Cannot convert undefined or null to object
body.artists.forEach(body => {
Object.entries(body.artists).forEach(([key, value]) => {
console.log(`${key} ${value}`);
});
i think i did wrong
artists property is undefined/null
@earnest phoenix artists is an array already
"artists": [ ...
body.artists.forEach(artist => ...
how do i get the message content of a command
@bot.command(pass_context=True)
async def help(context, message):
print(message)
if message.content == "a-help":
the error is message is a requirment that is missing
so if i type a-help [option] i wanna get the [option] part of the command
This is python
@slender thistle how do u replace string?
how do i make the number not send with a .0 at the end?
like i have a varable
in py
like it send like 10 istead of 10.0
I assume you're asking about python, hayper.
string.replace(what_to_replace, the_replacement_string)
like it send like 10 istead of 10.0
If you are sure you will get a whole number, int() or round() it
where is the error? too many artists write.
const sex = [];
for(var i = 0; i < body.artists.length; i++) {
sex.push(`${body.artists[i].name}`)
embed.addField('Sanatçı', sex.length ? sex.join(", ") : "Yok.")
}
Tbh .stripleft could work for the command
where is the error? too many artists write.
Or use .split(" ")[1:] and see what the argument was
@earnest phoenix my issue is passing the message content when the command is called
shIVacO heLP
@drifting wedge web dev?
pillow the python image editor thing
I'm invis for a reason
oh
I assume Pillow is blocking unless you are running it in a threadsafe executor
I judt notice, sorry for disturbing
which is only a workaround and not a solution
@mental willow show your command
code
it constantly opens .addField. what should I do for a single .addField. I'm a beginner yet
const sex = [];
for(var i = 0; i < body.artists.length; i++) {
sex.push(`${body.artists[i].name}`)
embed.addField('Sanatçı', sex.length ? sex.join(", ") : "Yok.")}
Don't know
@slender thistle ```python
@bot.command(pass_context=True)
async def help(context, message):
print(message.content)
if message.content == "a-help":
embeded_message = discord.Embed(
title='Help Version 2.4',
description='Type a-help [option] to get specific information about a component of the bot',
color=0xffffff)
embeded_message.add_field(
name='Options',
value=f'a-help music \n a-help leveling [Currently offline] \n a-help moderation',
inline=False)
await context.channel.send(embed=embeded_message)
if message.content == 'a-help music':
and how are you using the command
Just a-help?
Geez, use context.command.name == "help"
a-help or a-help [option]
message = None
it is erroring on the print
Have you tried asking in the Python server yet
i have
then do i need to use context.message.content when i am looking for the message content
ealier today actually
The message that invoked the command - yes
Don't check for message content though, that's pointless. Literally just check if your argument is equal to something
ok, i will see if i can get it to work
so PILLOW is blocking?
@drifting wedge PIL, Pillow... both are sync so yes
See d.py docs for a workaround
running in executor
It should be in the FAQ
Do I want to answer that
no, and no
It's not hard to answer it yourself if you think about it
yep
aiohttp is web requests
yep...
no
im reading the docs, i cant find anything on running in executor
u know which part?
Oh maybe it's in the d.py server as a tag somewhere
Try asking there, they might either throw the tag at you or tell you to Google it
thanks, i did google it
That's nice
im using a -say command but when i do -say @.here or @.everyone it pings everyone, how do i make it so when they use that command it doesnt ping people
Here is my code: https://srcb.in/0a7db7bf46
add a zero-width space between the @ and everyone
adding a zero-width space will do just that
how
@everyone
like @ evryone
oop
@everyone
how do u do that im so stupid
i want my bot to just not ping when other people use it @ here and @ everyone
search the input content for @everyone; if it exists, replace it with @everyone (with a space)
im kinda new and bad at coding so most of the stuff i learned is from yt, idk how to do that, do i have to do something like if(!@ everyone) return message.channel.reply('something')?
first, get the content of the message, in your case, message.content
second, use message.content.replace to replace at-everyone mentions
so i put message.content.replace('@ everyone')?
you can use one replace call to replace both at-everyone and at-here mentions
use this regex: /@(everyone|here)/g
message.content.replace(/@(everyone|here)/g, callbackFunction);```
for callbackFunction, it's a function that takes two parameters, and the second one will be either everyone or here
huh
replace alone does not change the original string
what?
no
stop that
bad advice
message has mentions payload
no need to regex or replace anything
disable_mentions
what
yeah so, i forgot that exists
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
this
im confsued
send() also accepts a second parameter that contains options for sending the message
?
or send the embed object directly
why ami sto stupid
send({allowed_mentions: parse[], content; 'CONTENT HERE', embed: 'EMBED HERE'});
its really not that hard mah dude
just add allowed_mentions on the message payload
when someone says "function "abc" accepts a second parameter" they mean
abc(parameter_one, parameter_two)
^^^^^^^^^^^^^
whatever this is
i dont have an embed
send(content, {disableMentions: ...})
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
thats the structure that the api follows
@chilly mason
ill try
it accepts a json payload, aka an object(im assuming you know what a js object is)
each one of those is a property
use the ones you want, they arent all necessary
Anyone here familiar with mongodb how do i have it so when i do a findOne() i can access the document variable outside the function like data.prefix outside of Data.findOne({ }, (err, data) => {...
Is it possible to know the instance of an object without using the instanceof operator? For example, here we have a GuildMember object and we want to know it's instance, it's obviously an instance of a GuildMember but we don't always know, every object has a different instance
message.member instanceof Discord.GuildMember``` so this is true, so is there a way to know the actual instance?
Anyone
knows the fix of this in heroku
Error waiting for network: Resource temporarily unavailable
@earnest phoenix you can use message.member.constructor.name
Huh, i didn't know that was possible, thanks
someone
knows this error Error waiting for network: Resource temporarily unavailable
my bot faced 6 hrs downtime
How you host your bot
i wanna throw everything in folder X to my github repository Y but i don't get any of this git shit (woah that rhymed). On https://glitch.com I can just click Export to GitHub select the repo and boom but now I'm on repl.it (TEMPORARY HOST DO NOT KILL ME) and there is no export thingy. How would I upload my folder X to my GitHub repository Y? (throwing the docs at me is fine unless they're npm docs)
reading codeacademy's git course
Is there a way to make a .exe file that runs node index.js when opened?
I'm very confused on how to make one in the first place
Is there a way to make a .exe file that runs node index.js when opened?
@karmic compass uhh yeah
@fathom topaz just wait and try again later
In the meantime look for a new host
ok
Anybody know what this error even is
<--- Last few GCs --->
[11:0x516d8e0] 38589 ms: Mark-sweep (reduce) 515.2 (524.9) -> 514.7 (525.9) MB, 1501.6 / 0.0 ms (average mu = 0.096, current mu = 0.002) allocation failure scavenge might not succeed
[11:0x516d8e0] 40093 ms: Mark-sweep (reduce) 515.7 (524.9) -> 515.2 (526.4) MB, 1503.0 / 0.0 ms (average mu = 0.049, current mu = 0.001) allocation failure scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0xa02ec0 node::Abort() [node]
2: 0x94e471 node::FatalError(char const*, char const*) [node]
3: 0xb765de v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
4: 0xb76957 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
5: 0xd311f5 [node]
6: 0xd31d7f [node]
7: 0xd3fe0b v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
8: 0xd439cc v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
9: 0xd120ab v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]
10: 0x105802f v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
11: 0x13fdfd9 [node]
/entrypoint.sh: line 11: 11 Aborted (core dumped) ${MODIFIED_STARTUP}```
some out of memory error 
JavaScript heap out of memory
you probably have a memory leak somewhere
This only happens if i try to show a collection that contains way too many objects
then don't show all of them
It's with eval
Just
Vx_eval message.guild.members.cache``` and there it goes
Or js bot.users.cache
It's over 200 lines
if you eval that, console.log if length >2000, and attach them if lenght is higher than 10k chars
thats what i do on mine
(i havent figured out a way to check line count rather than char, so im using chars)
Showing 10 million characters as my bot is, it's fine, but showing a 8 million character collection just fucks it up
that'd be my only recommendation
¯_(ツ)_/¯
try writing it on a temp .txt file and attach it
abort(RangeError: Source is too large). Build with -s ASSERTIONS=1 for more info.
(Use node --trace-uncaught ... to show where the exception was thrown)
wtf
here is full error
I like how immediately when someone gives an OOM error people say its a mem leak
sometimes its just because you have too much memory in use
@earnest phoenix did you check your bot memory usage
I already have, if it was a memory leak or my bot was out of memory, my vps would have thrown the out_of_memory property as true but it doesn't
wait does it only happen when trying to eval?
Yes
~/codeco-discord-bot$ git remote add bot-backup-repo https://github.com/code913/codeco-backup-repo.git
~/codeco-discord-bot$ git add .
~/codeco-discord-bot$ git push bot-backup-repo master
Username for 'https://github.com': code913
Password for 'https://code913@github.com':
To https://github.com/code913/codeco-backup-repo.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/code913/codeco-backup-repo.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
what does this mean???
yeah i use github for keeping backups
Git pull
lemme try
~/codeco-discord-bot$ git pull bot-backup-repo master
From https://github.com/code913/codeco-backup-repo
* branch master -> FETCH_HEAD
fatal: refusing to merge unrelated histories
github hates me ig

GIT PULL -FORCE
LMAO WHAT
force that puppy
use the force
~/codeco-discord-bot$ git pull bot-backup-repo master -force
error: did you mean `--force` (with two dashes ?)
~/codeco-discord-bot$ echo lmfao
lmfao
lol
GIT PULL --FORCE
LOL
~/codeco-discord-bot$ git pull bot-backup-repo master --force
From https://github.com/code913/codeco-backup-repo
* branch master -> FETCH_HEAD
fatal: refusing to merge unrelated histories
the force wasn't enough I NEED MORE POWER
looks at banana and screams GET IN MAH BELLY
GIT FETCH
-f 
GIT FETCH
GIT REBASE -F
git die
git commit -m "fine i'll manually upload files"
git remote remove bot-backup-repo
programmer - brain
= code913
e
common in local computer timing
oh



