#development
1 messages · Page 1411 of 1
Ic
let chx = db.get(`welchannel_${member.guild.id}`);
let autorole = db.get(`autorole_${member.guild.id}`)
const channel1 = db.get(`mcountchannel_${member.guild.id}`)
if (chx === null) {
return;
}
if (autorole === null) {
return;
}
if (mcountchannel === null) {
return;
}
let data = await canva.welcome(member, { link: "https://ak.picdn.net/shutterstock/videos/22276048/thumb/10.jpg", block: false })
const attachment = new discord.MessageAttachment(
data,
"welcome-image.png"
);
const mChannel = message.guild.channels.cache.get(channel1)
mChannel.edit(`MEMBERS: ${guild.memberCount.toLocaleString()}`)
member.roles.add(autorole)
bot.channels.cache.get(chx).send("Welcome to our Server " + member.user.username, attachment);
});
bot.login(config.token);
this is my guild member add event
@hasty mulch use bot.wait_for("reaction_add",....)
mcount stuff doesnt work
pls
i am trying from long time
pls
member count hannel isnt working
... being reaction?
@hasty mulch this
The dots being the reaction?
no
reaction = bot.wait_for("reaction_add", check = ...)
check for message and the user
You should read the documentation
@hasty mulch
U can also add a timeout
@unborn ridge idk js but ig member smthng requires intents to be enabled in py
In js too!?
enabled intents
Added intents in code too?
listen
How do you guys detect a "general" channel where bot can send a message when it joins the guild? I currently just get the "first" channel the bot has permissions to send messages in. I would like to improve that function, need some feedback. (ping me)
@stoic girder you could either loop through the channels and try to find one that has the name "general". Another option I can think of (which isn't very efficient but might work) is to count the messages in each channel and find which one is the most popular. I'm sure there are more clever people out there who can help you with a better solution though.
Use the first channel "everyone" has permission to send a message :)
fields.flat is not a function
What's up?
how do I store an array, object, and boolean, in an SQLite3 datebase
SQLite3 does not support arrays directly. Basically, it only does Ints, Floats and Text. To accomplish what you need, you have to use a custom encoding, or use an FK, i.e. create another table, where each item in the array is stored as a row.
Use integers for boolean, 1 = true, 0 = false
I see, well in that case
Arrays / Objects should be separate tables
Or you could JSON.strinigify them but that's kinda cheating
kekw,
alright then, any other SQL databases that could store Arrays, Objects, and Booleans, without any additional tables/rows?
postgres?
I looked at that, but not sure how I would use it on the vps since I suck at linux vps
Why does it have to be SQL? You could go with mongoDB
I am done with mongodb
lost all my data because mongodb fucked up
just completely randomly it just broke
that's unfortunate
-atmods
Please do not mention (ping) more than one or two moderators for help, unless there is an emergency.
Here are some examples of emergencies:
- Raids / Multiple members mass spamming.
- Severe disruption of Discord's ToS (NSFW content, etc)
- Anything that requires more than 2 moderators to handle.
...
thats why i used quick.db
Can you explain why you pinged 25 moderators @dusky sundial
quick db is not a good db though
ii think he is getting ||mad||
Use our github repo
still
can u send me iit
it works best for be
Quick DB is too limited to be used in any serious project involving a database
-faq 9 @drowsy epoch -c
@drowsy epoch
i want to ask
Okay, thanks
@flat pelican someone self-promoted in here, didn't know I wasn't supposed to mention the role. My bad
Please keep this channel on-topic
Move on #general if you don't need any code related help
anyone know the rate limit for editing messages in announcement channels
i just thought i'd say, on a development note, i really LOVE sphinx search.
doesnt matter how big the dataset is, dont seem to be able to slow it down
@grizzled raven rate limits arent set in stone, discord adjust them depending on system load, your bots behaviour and other factors and they dont make the current value public
never heard of sphinx search
oh okay
the only thing you can do is respect the x-ratelimit headers correctly
if you respect the rate limit headers and only send the amount it says, when it says, youll never get rate limited
usually your library will handle this for you
i have some code that doesnt use a library... and it basically does this
if (isset($r_headers['x-ratelimit-remaining']) && $r_headers['x-ratelimit-remaining'] == 0) {
/* Sleep and wait until we can send again */
$now = time() - date('Z');
$later = $r_headers['x-ratelimit-reset'] - date('Z');
$seconds = $later - $now + 1;
if ($seconds > 0 && php_sapi_name() == 'cli') {
sleep($seconds);
}
}
thats used in a script external to my bot itself, to send a queue of role changes, dm's, etc
its hacky, but it works
it'd be better if there were some guide i could take, like instead of sending a request every second not knowing i should be sending it every 30 minutes or whatever
but yeah thanks
thats what x-ratelimit-reset tells you
how many seconds before you can send that request again
@cinder patio sphinx search is awesome, it can build a google-like stemmed search index of any data source, like mysql, mongo, mssql etc, then it presents a mysql compatible interface for searching, so you connect to it on its own port and just do like: SELECT * FROM searchindex WHERE MATCH('something')
and it returns matching rows 🙂
looks nice indeed
im using it in my admin backend to allow moderators to search for questions for finding duplicates etc
i was using a regex search with mysql RLIKE keyword
i dont really have a use case for it at the moment, but good to know about it
but its too complicated to do boolean searches with a regex, for non-technical users
npm install ffmpeg-static
Uh, what was the value thing for blank again
this?
blank thing?
you mean empty field?
Yeah?
"\u200B"
Get rid of the "undefined" value
show your code
I Did it once before but forgot
if(args[0] === "Admin".toLowerCase()) {
let usuario = new MessageEmbed()
.setAuthor(message.author.username, message.author.displayAvatarURL({ format: 'png', dynamic: true, size: 1024 }))
.setTitle("Admin Commands")
.setColor(message.guild.me.displayHexColor)
.setTimestamp()//Este es el embed de error, Solo necesitas uno. //:v, ok xdxd
.addField(`\`,panel\`\`,done\`\`,site\`\`,status\`\`,list\`\`,rate\`\`,form\`\`,host\``)
message.channel.send(usuario)
Yeah, i was wondering what to set as value xD
if you want to have no title, you can do .addField("\u200B", "your content here")
or the other way around if you want no value
Thank you Tim
setDescription
Hey, today I realized my bot wasn't working, I printed the debug info to the log and this is what is shown:
and yeah, would make more sense to use a description instead of a field
Any idea what this means? I'm using Discord.js
Maybe regenerate your token?
I did
you exceeded the daily login limit

you cant login again until your limit is reset
Thats 18 hours wtf
Bot be like: Restart every 10 minutes
I don't know what's going on, because this bot's been up for months and I didn't even touch it 🤔
does it have a process manager like nodemon, forever or pm2?
pm2 yes
Someone might've been spamming a comamnd that causes the bot to overload and to crash
:o
likely something happened that caused it to crash at login
so it kept retrying until it used all 1000 logins
makes sense
does pm2 not show any error or crash logs?
1000 logins
try pm2 logs botnamehere --lines=500
But he said he didn't touch it in months
ok
and see the logs from the error log
oh frick it's a regex error in my command parser 😛
rip
Hello,
While sending a python syntax message, when I type a # it comments out all the code after it. But python supports single line comment with #
Hi everyone, I have a problem with Discord.py, I want to send random memes without reddit api because I want custom images, but I can't find code for that.
Why i have a error in this code
if (message.content = "list") {
let data = await Guild.findOne({ guildID: message.guild.id })
let Cmd = []
for (let i = 0; i < data.whitelist.length; i += 1) {
Cmd.push(`<@${data[i].type}>`);
}
message.channel.send(Cmd);
}
if you use a automatic login after a crash or season timeout make sure to add a delay or you end up getting locked out of the API. had the same issue, now i have a 10 seconds delay before the bot logs in again. if he fails 5 logins in a row he goes offline
I have a error in Cmd.push(...)
what did you want to add to your array? the string?
What's the error exactly
thats the best answer tbh
So the index you're looking for in that data array is undefined which means it doesn't exist
Did you mean to do data.whitelist[i].type?
Wait a minute, why are you even doing a for loop anyway
${message.member.voice.channel.client}
not work
await Guild.findOneAndUpdate( { guildID: message.guild.id, }, { $push: { whitelist: { type: user.id } }, })
this is wrong
type is not defined
right?
😅
type is used for Defining what sort of field it make in the Document
Wait iam testing
just remove type
if you want to use the userid as key make it an object
The error isn't because of that
Yes
well he doenst get valid data bcs of this
data[i] is undefined
Wait
I send a file
this
work
but
${message.member.voice.channel.client}
not work
what solution

Channels don't have a client property
so
?
what did you want to get in the first place?
id?
<What are you trying to do>
<#${message.member.voice.channel.client}>
vc tag
Look
you want to mention the voicechannel?
lol
${message.member.voice.channel}```
@earnest phoenix is selfbotting
I think yes
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.
Self bot
@flat pelican
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.
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.

he gone
he's definitely getting beaned
I have error in line 65 in type
@solemn jolt remove the type: where you push the userid
@client.command(pass_context=True) async def meme(ctx): embed = discord.Embed(title="", description="") async with aiohttp.ClientSession() as cs: async with cs.get('https://www.reddit.com/r/dankmemes/new.json?sort=hot') as r: res = await r.json() embed.set_image(url=res['data']['children'] [random.randint(0, 25)]['data']['url']) await ctx.send(embed=embed
!yardım
wtf this bot
@drowsy crag selfbottumn
@lusty quest how
@weak parrot here is a selfbot
@earnest phoenix vc tag not possible?
that looks like selfbot ?
!yardım
huh
send a link
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.
hmm
Wow Karen
@solemn jolt Change it to this
let arrayIfCustomCommands = data.whitelist.map(w => w.type);```
Done
@solemn jolt whitelist: {user.id} }
I test this
That's not where the error happens
@client.command(pass_context=True) async def meme(ctx): embed = discord.Embed(title="", description="") async with aiohttp.ClientSession() as cs: async with cs.get('https://www.reddit.com/r/dankmemes/new.json?sort=hot') as r: res = await r.json() embed.set_image(url=res['data']['children'] [random.randint(0, 25)]['data']['url']) await ctx.send(embed=embed
and when he try to get the Userid its undefined
bcs Mongoose wont write it into the db
Hello, I have a problem with that code
The error happens in data[i].type where data[i] is undefined when he was planning to Iterate through data.whitelist as he did data.whitelist.length
yea but this will be still empty
bcs the Validation Mongoose does blocks that he writes data to the database
Ok
What's the result that you got?
iirc you cant tag VC channels
quick.db not working with heroku?
Heroku doesn't support external databases
how to store data then?
Well in saving data after restart
Use MongoDB as an example
Heroku supports external DBs but no local DBs
you can get quick.db working there but with some stupid workarounds
heroku's free dyno resets everyday
yea this is why Free hoster suck
pls tell
idk how never used them but i know a few users here use a Github repo to write the db files in there before it restarts
😮
and if the bot starts it pulls the files from github
ok ty
i do not recommend it
json files are used to store data?
use Firebase or MongoDB atlas for a better way to save stuff
dont. use it only for Configs
ok
@earnest phoenix this code get me the all id but how i can mention it?
let arrayOfCustomCommands = data.whitelist.map(w => `<@${w.type}>`);```
Thankyou😁 👍
How do I add coins to a mentioned user, it's currently only removing them from me
const mentionedMember = message.mentions.members.first();
money[mentionedMember.id].money + parseFloat(args[1]);
money.money - parseFloat(args[1]);
money.save();
I've been trying 100 different things but cant see it
isn't it args[0]?
it should be args[0] i think
I mean, its removing it from me so its working
try args[0]
its the money[mentionedMember.id] part
what's the best vps for discord.js?
i use a digitalocean droplet
the 5$ droplet gives you probably enough power for your first 1k Guilds (depending on how efficent your bot uses the resources)
?
some context?
message.channel.send({
embed: {
color: 'AQUA',
author: { name: `Here are your search results for ${query}` },
footer: { text: 'HAPPY' },
timestamp: new Date(),
description: `${client.emotes.music} - Now playing ${track.title} into ${message.member.voice.channel} ...}`,
},
});
};```
right?
no idea xd
any buddy help me plz
if you give some context
@earnest phoenix https://stackoverflow.com/questions/63376186/how-to-make-multi-languages-in-discord-bot as example
context?
trackStart.js
its a file name?
what did you want to do as example. some context about what your plan is, what issues you have
i try to add embed
on
${client.emotes.music} - Now playing ${track.title} into ${message.member.voice.channel} ...
and?
nothing

we can totally help you
/s
what tf happens nothing is helpfull as water is wet
you give 0 useful informations
^
like what is the expected outcome?
lol
does your embed contains the description?
lol
bro i cant see what is wrong
if(message.mentions.members.first() === message.author.bot) return message.channel.send('dont be dumb, im not DMing a bot')
your comparing an object to a boolean
can i do that?
if(message.mentions.bot.first()) return message.channel.send('dont be dumb, im not DMing a bot')
is it a thing?
no need
figured it out
if(message.mentions.members.first(bot)) return message.channel.send('dont be dumb, im not DMing a bot')
sorry what
wth, weren't you a moderator?
Was
One message removed from a suspended account.
xd
why what happened? if i can ask that and if you want/can answer that
just look up
message.mentions.members.first().send(bla bla)
and just make a command for that
with args
np
An alien brainwashed community managers to demote me because I forgot to pay them 69 USD for monthly moderator subscription. Since then, Veld has contacted me to resolve everything out, but I demanded he paid me for damages in hugs, although I still have not received any.
I'm starting to think that having no time and feeling stressed out doing this all day all night did not help, either. It may be just me, but I believe the aliens are out to get me and ruin my life. Please help. I'm stuck in this plastic box with aliens around me.
On a serious note, time and stress are the main reasons
wth you pay 69 dollars for being a moderator
It's the aliens, man...
Veld has contacted me to resolve everything out, but I demanded he paid me for damages in hugs, although I still have not received any.
lol i just read it and understand
if(message.mentions.members.first()) return message.channel.send('dont be dumb, im not DMing a bot')
how to i make that if its a bot it will return
let mention = message.mentions.members.first();
if (mention && mention.user.bot) return message.channel.send("Don't be dumb, I'm not DMing a bot.");```
OAuth2 bot dashboard is pog
aaanyways...
PHP 8.0: 10 years in the making, 8 new features!
so....
they're just a tad bit too late

php 🚮 compared to other web frameworks and templating langs we have today
php compared to reactjs is just... laughable
I get that it's good for back-end, that's fine. But front-end? gimme a break.
I think mariaDB corrupted, does somebody have any knowledge and would be free to help me?
soooooo
Basically I am trying to make a welcome image, and I want the canvas size be the url width and height.
I tried url.width, url.clientWidth, url.naturalWidth, and many more i found on internet...
I was also given an error when I tried those things
(node:217) UnhandledPromiseRejectionWarning: Error: the surface type is not appropriate for the operation```
I also tried making embed setting image and console logging and it said width and height was 0. I tried changing urls too
any other things I could try?
oh yeah I also tried getting the width/height using an npm and it failed
does anyone know, how I can let my bot print out a list of Servers, he is in (maybe via a txt file)?
Could we see the code?
thats not how it works
imgUrl is a string, not an image
it has no with or height or anything, its just text
you can use discord.js's messageAttachment to download the image for you
why would I download
let image = new Discord.MessageAttachment(imgUrl);
you cant know the image size without downloading it
it just doesn't work properly
oh
actually the messageAttachment class cant download it for you, you need to do it yourself
the member is not cached, therefore the .get() returns undefined
and you probably have it fall back to the message author
will fix
yes, i have seen my error
i am trying to host discord bot in heroku with github but if deploy get success then i get an application error.
how to solve it
thank you
what error
well if I want to have it for multi guild then it's not very convenient way
you can use loadImage from canvas to get the size
thats why caching exists
it show like this in launch page
Application error
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command
heroku logs --tail
and did you check the logs?
ya
and?
i try to run in heroku run
but in it it shows module not found
i type ls
then it shows all file but not the folder
you need to say what the logs are, what the error is, what module was not found
It show like this when i typed node index.js in heroku run
install discord.js
?
your Bot?
same module?
ya discord.js
it doesnt, my mistake
I see
i just hands off the url to discord when sending
however it does have image metadata when you receive it, like width and height
but not when you send it
Hello guys.
I need help
I developing a bot to monitor changes on sites like nike, maze artwalk and more in the shortest time possible and in a way that shows me the link of the things that entered.
But, I don't know how start.
Please help me.
Help, dad
Collect the site data, then if it didn't match up with the data 5 minutes after, do something
I recommend axios
Then store it to a local file
Thanks
I can't help you as I'm on mobile
Help me
const data = require('./data.txt')
setInterval(async () => {
let site = await axios('your site here')
if (data !== site.data) channel.send()
fs.writeFile('data.txt', site.data)
}, 300000)
Something like that
@carmine chasm
can i get help??
Yea sure go ahead@earnest phoenix
Just ask the question
my voting is not showing
Screenshot
No error in logs!
Screenshot
Of?
It doesn't send webhook
Thank you so much.
Hello, I need help there is my bot, which is premium 28 days but it is disconnect so it is not supposed to be what to do?
No when someone vote it doesn't send webhook
No one can help you if you don't show what you've tried
Clem could you rephrase your question.
Define 'premium'
MEE6
auctions

what i do
sorry, i speak French
What is going on
je voulais dire, mon bot sest deconnecter alors que il est censé etre connecté que faire ?
@hollow sedge i send you my code ?
Well just send it here
Alright, but its private should i send in your dms!
If it's private you probably shouldn't send it to me anyway
@hollow sedge
Refresh your token
@devout mortar quel site est hébergé par le bot?
Yeah
I regenerated it
That is private
So when you post your code just remove it
or store it in a separate file or as an environment variable
Which you should be doing
@devout mortar est-il auto-hébergé?
Do you know what an environmental variable is?
bot désigner
@hollow sedge should i invite in My project??
est-ce un bot populaire comme MEE6?
non
sigh no I don't even use JS
What site?
@devout mortar Quel site
And you should've kept it in an environmental variable
i have my token in config.json
Avec l'application bot désigner
i have my webhook token in index.js just
discord.js
user.presence.status doesn't work, how do I get the user status?
@devout mortar Où avez-vous acheté premium
What happened lol
You were right
dans bot désigner aussi,
dans la fonction premium
@hollow sedge how i fix??
can someone help me
@devout mortar Donc, je suppose que le concepteur de bot est également l'hébergement, ai-je raison?
Just ask the question
je sais pas, @carmine summit
vous devez donc accéder à la page de l'application du bot, puis obtenir le jeton du bot. puis dirigez-vous vers le site premium et collez-y le jeton
@devout mortar
@devout mortar sur l'endroit où vous avez acheté le service premium
daccord
i am trying to host my bot on Heroku with GitHub.
I deploy and then it show all are right
when i opned app it show
Application error
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command
heroku logs --tail
I tryed in heroku run.
it showsmodule (discord.js) not found.
I installed in it by npm install discord.js.
Then also not.
I used git clone
Then also not woeked
What did it say when you typed in npm install discord.js
Was it something like missing perms?
Can you show me your code
which code
Code.
?
Your code
bot code?
Yes
const discord = require('discord.js')
const client = new discord.Client()
const acl = "mte!clean"
client.on('ready', () => {
console.log("I am ready")
})
client.on('message', (mes) => {
if(mes.author === client.user){
return
}
if(mes.content === 'mte!setup'){
mes.guild.emojis.cache.forEach((emo) => {
mes.channel.send(emo.toString())
})
}
if(mes.content === 'mte!help'){
mes.client.user.send()
}
if(mes.content.startsWith(acl)){
cl(mes)
}
})
function cl(mes){
let ful = mes.content.substr(8)
let sp = ful.split(" ")
let arg = sp.slice(1)
let ss = arg.toString()
if(ss){
me.channel.bulkDelete(ss)
mes.channel.send("Message deleted")
setInterval(() => {
mes.channel.bulkDelete(1)
}, 5000)
}else{
mes.channel.send("Enter mt!clean <number_of_message_want_to_delete>")
}
}
client.login(bot_token)
Looks clean
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Can you try to re-deploy it?
The installation is success...
And the code is clean
in deploy log no error shows
I suggest showing the actual error that occurs when trying to start.
{
"name": "mtebot",
"description": "a really cool app",
"version": "4.15.0",
"engines": {
"node": "12.x"
}
}
thats the problem
rip deps
on every redeploy, all your packages get deleted because you have no dependencies
you need to add discord.js to your dependencies
how
And this is why, ladies and gentlemen, why you should buy a vps
"dependencies": {
"discord.js": "^12.5.1"
},
where i have to add it
in your package.json
after which code
Below the engines object
anywhere as long as its on the root level
ayy
ok ik this isn't related to discord per say but how do i make connect four happen??
you can buy it in your local store!
you want to code a connect 4 game?
come up with a basic data grid to represent the field
2d array
am i allowed to post code here? cuz i can show what i have already
then on each move, check if there is 4 in line
is it matrix or matrices
valid_c_movements = [ i for i in range(1,8) ]; valid_c_movements.append("q")
@client.command()
async def connectfour(ctx,member):
opponent = ctx.message.mentions[0]
await ctx.send(f"playing connect 4 with {opponent.display_name}")
g = [[1,2,3,4,5,6],[7,8,9,10,11,12],[13,14,15,16,17,18],[19,20,21,22,23,24],[25,26,27,28,29,30],[31,32,33,34,35,36],[37,38,39,40,41,42]]
gridstr = ""
for i in g:
for j in i:
gridstr += f"{j} "
gridstr += "\n"
await ctx.send(gridstr)
for i in gridstr.split(" "):
if str(i).isdigit():
gridstr = gridstr.replace(f"{i} ",":blue_square:")
bmsg = await ctx.send(gridstr)
if bmsg:
pass
moves = 1
while moves <= 42:
def check(message):
user = message.author
return user == opponent if moves % 2 == 0 else user == ctx.author
m = await client.wait_for('message',timeout=None,check=check)
c = m.content
if c not in valid_c_movements:
continue
if c == "q":
await ctx.send("game ended")
return
if c in "123456789":
pass
oh its python i forgot to mention that
heres what it generates; ideally it would be a square but its obviously not
what if you send it inside codeblock
would it be possible for me to use the cygwin terminal as my default terminal for vscode? If so, how?
In Discord.js the 'guildMemberAdd' event doesn't appear trigger whatsoever? What's up with this and is it fixable, I have tried giving gateway perms and I have the latest version of discord.js
do you have the guild member intent enabled?
do you have it enabled on your discord dev portal page
html n css
These, right
and you added them to your client?
How do I do that
means how?
can u give code?
no, we dont spoonfeed code here
ik but
thnx
so I gotta get it verified?
If your over 100 guilds yes
no just add GUILD_MEMBERS to get your events enabled
yep
const { ShardingManager } = require('discord.js');
const manager = new ShardingManager('./index.js', { token: 'fake token' });
manager.on('shardCreate', shard => console.log(`Launched shard ${shard.id}`));
manager.spawn();
manager.on('message', (shard, message) => {
console.log(`shard[${shard.id}] : ${message._eval} : ${message._result}`)
})
its not console logging the thing
both or one
they separate connections, so that your bot can have more guilds.
okay
i knew i t do something like that
and i didnt get why people told me to do it
i knew i t do something like that
and i didnt get why people told me to do it
because isnt is good when your bot is on 20k servers?
idk what do you mean by that
https://custom.discord.re/ this may help, @earnest phoenix
you need it at 2500 guilds because discord doesnt allow more than 2500 guilds per connection
how do i dark it ?
using css color
like how?
shards doesnt exist anymore afaik
sorry ill clarifiy, client.shards doesnt exist anymore
so how can i see how much
mt bots twitter got deactivated because i set the year to 2020 lmfao so now i gotta get my birth cert
client.shard I think
Hey, brother, what you thinking?\nLeave that old record spinning\nYou feel the rhythm going\n(They call it lonely diggin')\nLet's end your time to lay low\nYour knees are bending and so\nIt's time to get up and let go\n(You're gonna come undone)\nHey, mama, how's it going?\nCan't see your body moving
How do I get all the sentences up to \n in the above paragraph?
ex: ```
Hey, brother, what you thinking?\nLeave that old record spinning\nYou feel the rhythm going\n(They call it lonely diggin')\nLet's end your time to lay low\nYour knees are bending and so\nIt's time to get up and let go\n(You're gonna come undone)\nHey, mama, how's it going?\n
js right?
you could do
lastIndexOf() to get the last \n
oh why not just get up to a certain length then
thats just color ^
he wnts to that only lol
@solemn latch I'll make an embed page.
I don't want broken words and sentences to appear on the pages.
okay, so get by length, then do the index stuff.
but how would i do it to an image?
add .gif not .jpg @shell plaza
ok
if it works let me know @shell plaza
nope
give me link
probably doesn help the url gives a 404
i send tht by mistake lol
yes
the preview might not load new images.
TF
check dm
thx
np
Hey, does someone have a idea why my canvas filter isn't applying?
Here the eval link: https://discordapp.com/channels/264445053596991498/265156286406983680/781939495691747329
@rare plume maybe you have to add the filter after you draw the shape?
Let me try
@shell plaza dark theme overrides your styling for whatever reason
const ques = args.slice(0).join(" ");
const google = 'https://google.com/search?q=';
if(!ques) return message.channel.send('What do you want to search? Type - `\`google <search>` to search anything.')
const embed = new Discord.MessageEmbed()
.setTitle(`Google search - ${ques}`)
.setDescription(`**Search:** ${ques}\n**Results:** ${google+ques}`)
.setColor('#22f2f2')
.setThumbnail('https://upload.wikimedia.org/wikipedia/commons/thumb/5/53/Google_%22G%22_Logo.svg/1004px-Google_%22G%22_Logo.svg.png')
message.channel.send(embed)
This is my code for google search but it is working if ques has no space but how to check if ques has space?
Did not fixed it
😦
idk the reason then
how do i do a force ban command in discord.js v12?
I have just started to use sqlite3, within the get function, I can access the data, but I can not access it outside of the get function, anyone some experience with sqlite3
if(message.content ==".getprefix"){
let query = `SELECT * FROM data WHERE userid = ?`
var a = db.get(query, [userid], (err,row) => {
if(err){
console.log(err);
return;
}
if(row === undefined){
let insertdata = db.prepare(`INSERT INTO data VALUES (?,?,?)`);
insertdata.run(userid,uname, "none")
insertdata.finalize();
db.close()
return;
}else{
let userid2 = row.userid;
let word = row.word;
console.log(row) ///THIS WORK
}
});
let result = db.get(query, [userid]);
console.log(result) ////THIS DOESNT WORK
}
Put all the code that needs the result inside the callback you provide in the get function
or promisify the function
Yes, but how should I then specifiy a prefix command, when I only can interact within the get function
I understand that it will work within the get function
hmm
I keep getting Could not parse font file error.
const { registerFont, createCanvas, loadImage } = require('canvas')
const Canvas = require('canvas')
Canvas.registerFont('fonts/Bradley Hand Bold.ttf', { family: "bhb" })
you should cache your prefixes
what are you confused about lol
making a call to your database everytime you want to get a prefix is retarded
cache it in your memory
ok^^
If anyone got idea for me please ping thank you 
@stark abyss it isn't the right directory, if that code is in welcome.js
literally just follow folder structure
you're inside of the folder, exit it
../
now go into the fonts folder
../fonts
and select your font file
../fonts/file.ttf
oh
pls you don't need a package for everything stop bloating your app
I see thank you cry
that project also seems to be abandoned
look, I want to ask, but I feel like, you will be mad, for asking such an obvious question, but I am not sure what you mean with caching your prefix in the memory. Save it as a variable? It wont be saved for a long time then, or did I misunderstand you. So having a prefix command is only something to have for a temporary time?
imports registerFont from canvas
imports canvas
uses canvas.registerFont instead
Save it as a variable?
This is an example of caching in-memory.
do you understand what caching is
or having a map
map
or an array
I mean, what else could I do, parse it into a json
what do you mean, then? I am not so sure, honestly
Think of caching like asking someone for the answer to a problem. You could keep asking and asking that person, or you could ask them and remember what their response was so you don't need to ask them again. Sometimes, cache expires (e.g. you forgot), so you may ask that person again.
I mean, it isnt like it is soo obvious
instead of you getting your prefix looking like this
message event => getPrefix
getPrefix => get from database
turn it into this
message event => getPrefix
getPrefix =>
if Map has the prefix for the guild, return that
else get from database and throw into the map
return result from database``
setPrefix would essentially be the same, update in your map and update in the database
this way you won't be slowed by database calls
you could also use a redis server as a cache
but this makes sense if you got more than one shard i guess
Can someone help me with a parentheses problem
what is your issue?
Here, you can borrow mine: (((()))))
Forgot your cons & nil
How do you get the items in the cache to expire though?
what did you use as cache?
I don't have a cache, I'm just asking
if you use node-cache or redis you can set a ttl
map is probably until you restart or overwrite
there is the ability to get a free redis server if needed
perhaps you could just set a length limit for map? Although that might be a bad idea
you get a 30MB cache (doesnt sound much but its enough)
From where?
you dont need even a credit card
if you want to see what is in your cache Redsmin.com can help you
that kind of defeats the point of caching though, does it not?
If you're trying to optimize speed you probably shouldn't be storing it in the cloud
why?
yeah
there's still latency while accessing the server
That's true but it's still not as good as it could be
you add back the latency you removed
but like i said earlyer it makes more sense if you got more than 1 shard or mutiple servers
Now my description is plain text.
to me it's just bloat
redis is easy but if you want to run it locally use node-cache
servers no real purpose unless you need to share cached data between two or more processes
How else would you have a cache?
Could someone help me with something?
use your language's native types, i.e. js has a Map, python has dictionaries
why node-cache when you can just use objects or maps w
nice
Yes but how would you make those keys expire
he asked about a ttl idk if you can set it for a map tho
setTimeout
hm..
yea frick the simplest stuff is the best
interesting
i mean the broken css page looks nice
and of course im trolling
o
if you want absolute expiry, a single timeout for the entry will do the job
if you want sliding expiry based on getting, you need to cancel the timeout and create a new one everytime get is called
So you would need to store references to the timeouts too?
you can save a timestamp property and update it every time you access it, somehting like lastAccessed:Date.now()
then have an interval that cleans up all items older than X
Ah that makes sense
node-cache uses a map as cache but adds a easy to use key management and ttl and other stuff. but i guess the way tim and cry suggest is also fine
Css isnt working 
hey i have a question, is there a way to manually edit the sqlite db file without this happenin (node:363) UnhandledPromiseRejectionWarning: SqliteError: database disk image is malformed
or in other words, is there like a website i can connect my db to where i can manually edit values?
yeah i know
but
is it possible to manually edit it
like for instance one thing in the db is
userid_tokens
i tried to manually change the tokens, it errored
so is there any possible way to edit it manually without using a cmd?
Pretty sure you cant recover corrupted sqlite files
Probably but you would only read byte code I would guess
if the file is intact, you can use something like DB browser
No
its a windows program
o
ty
what for?
quick.db has nothing to do with it
windows 🤮 linux 😎
did you download the installer or the portable one?
uhh installer
did you install it?
why are cogs so hard?
it should be in C:/program files
thyere making me thinking of giving up on this, they just give constant errors
o found it thanks
it's not that difficult if you think about the logic of it. Commands are objects instantiated from the command class. D.py calls the setup function and gathers the commands in them and adds them to the bot.
it just all goes wrong and idk why but ill try again for the 50th time
show your code for one of the files
ive already deleted the code sooo 
why tho
slightly giving up on it and wanting to cram it all into one single file
the self and stuff does have to be bot and not client right? @hollow sedge so e.g self.bot etc
im reading the docs
hey hey
why is the "H" in your nickname capitalized?
yes

it kinda triggers me xD
That makes us lose brain cells
it's just whatever you named the variable @safe creek
wdym?
yes
mmmmmmk i see
it will be aripoearyear if you put it as aripoearyear
bot is just shorter and an example then
so i have this function to process midi notes
fn process_events(&mut self, events: &Events) {
for event in events.events() {
match event {
Event::Midi(ev) => {
match ev.data[0] {
144 => self.notes += 1u8,
128 => self.notes -= 1u8,
_ => {}
}
}
}
}
}
however, at match event i have an error:
patterns `SysEx(_)` and `Deprecated(_)` not covered
wat
yes
a 2d array is array[y][x] right
yeah
ok
im making a connect four bot (actually a connect four function of a larger bot) and i need to detect if theres a tile below the current tile before it places the tile
i have a 2d array i'm using to generate the string which is like [[1,2,3,4,5,6,7],[etc] until 42
below would just be array[x][y+1]
you're probably just going to have to do a ton of checks
unless there's some algorithm lol
im not worrying about winning rn
just about placing tiles
i already have tic tac toe in the bot and it can't be that much different
why would you need to check if there's a tile below the current tile?
because gravity
i thought 2d arrays were array[y][x]
same thing
if i have a square: 123 456 789, i refer to 4 using square[2][1] correct?
ok
assuming your array is [[1,2,3],[4,5,6],[7,8,9]]
no
yes
i think it would be square[1][1]
array[1][2] array[2][2] :)
yes
i just had a brainfart
square[1][1] would be 4
What would #development message be xd
that's what I'm saying
[[1,2,3],[4,5,6],[7,8,9]][1][0] would be 4
6, 9
ReferenceError: stack trace failed ah shit
Wait there's 1
(0, 0) | (1, 0) | (2, 0)
(0, 1) | (1, 1) | (2, 1)
(0, 2) | (1, 2) | (2, 2)
i think this is a better representation
Bruh tuples
smh wouldn't it be better if (i32, i32)




