#development
1 messages · Page 1205 of 1

over 2000 chars 
wtf dude
JUST the embed?
Hypixel has alot of shit to handle
I've got a d.js question. I set my game status on ready event, but after a day it seems that the status goes away
@faint prism Anyone have an idea on this one?
I mean, I could make a for loop and an array to handle it
i can already think 2 ways to dry the heck out that
Hi
It's almost like it expires
I'm new
you could setInterval really high as a quick patch tbh
@opal plank Yeah ig lol
I just joined
someone help me my bot doesn't connect to discord api
aight time for food, then i'll come back to help more
I just joined
@jolly knot great. Do you have a #development question?
I want to know how to make bots
It's outlined in #502193464054644737 🙂
Ok thanks!
No problem. Cya soon!
Bye
||prediction: returns with questions about basic syntax for JS||
i don't really know what to do with the output of permissionsFor i got numbers but i don't know on what it's based
Something similar in the lib then?
hm i don't know it return smth like 2147483647
Should be outlined in the docs if you search it for permissions
That's bitfields
djs has helper methods for bitfields
for example you can do permissionsFor(id).has(permission) to check if someone has permissions, or permissionsFor(id).toArray() to list all permissions they have as strings
djs has helper methods for bitfields
@quartz kindle Sounds like what I'm thinking of. I've seen a bunch of people manually mapping the permission's bitfield when it's already implemented by the lib
@opal plank quick question, does .addFields accept arrays?
I plan to make a for loop to handle the array making and use the array to just .addFields(array)
ight thanks
Any jQuery masters in here that could assist with something?
I'm trying to select this element but I cant get it working because all the names are the same
pog moment, addFields is only available to v12
why not use v12
is it alright if i do that for the people who test the bot ?
I need to look precisely for the roles he needs?
Ideally
Admin is a pretty powerful role
And I'd imagine most guilds wouldn't give it
right
You should focus on needing permissions for for only what is absolutely necessary for each command to function
mine just needs the role to delete other messages i guess
Like !kick - Error, can't kick without necessary permissions
k thanks !
how can i calculate between two dates?
wdym ?
40 days after 31 August
:0
hmm
😄
maybe google it
I will use it for premiumSince
cuz i never try that beffore
or is there an easier way
If the user's boost is greater than 1 month, it will show the 2nd level boost icon.
if your time values in milliseconds, you can just add 40 days in milliseconds.
@white drum how ur messageDelete code
userinfo.boosttarihi = moment.utc(message.guild.members.cache.get(kisi.id).premiumSinceTimestamp).format('dddd[,] DD MMMM YYYY - HH:mm')
There like
No reason for it to crash
some messages have no author, such as system messages
btw
And it would crash randomly with the same kind of error
message.user is not a thing?
Message.member
message.user?
I think
no
client.on("messageDelete" , (client, message) => {})
message.author
there is no channel
why client
Why can't I have channel
the event doesnt give you a channel
it doesnt return channel
it only gives you a message
But, it's different for every channel
message has property channel
sa
huh
Visual Studio Code burada botu nasıl 7/24 yapıcam
mod only commands 
you told him to come here 🤔
lol
Visual Studio Code How do I make the bot here 24/7
get a vps
using python
aH
omg
ah the spam
AEEHHHHH
how can i check if youre in the vc with the bot alone?
would it be if there are 2 users?
- OVH: https://www.ovh.com/us/vps/
Starting at $3.35/mo for 1 core, 2GB RAM, 20GB SSD
- DigitalOcean: https://www.digitalocean.com/
Starting at $5/mo for 1 core, 1GB RAM, 25GB SSD
- Linode: https://www.linode.com/
Starting at $5/mo for 1 core, 1GB RAM, 25GB SSD
- Vultr: https://www.vultr.com/
Starting at $2.50/mo for 1 core, 512MB RAM, 10GB SSD
- Amazon(AWS) Lightsail: https://amazonlightsail.com/
Starting at $3.50/mo (first month free) for 1 core, 512MB RAM, 20GB SSD
- Time4VPS: https://www.time4vps.eu/
Starting at €3.99/month for 1 core, 2GB RAM, 20GB SSD
- VIRMACH: https://virmach.com/
Full Windows and Linux Desktop VPS starting at $7/mo and $1/mo respectively
- This is a list of hosting providers, not a backing/support for them. You will need to make your own decision. All $dollar prices are in USD.
plus amazon and google have free for 12 months plans
and google also has a free forever plan, that only charges for bandwidth
._.
Whenever someone deletes an embed
How can I make it ignore that so it doesn't crash xd
check if content exists
^
how can i check if youre in the vc with the bot alone?
would it be if there are 2 users?
@earnest phoenix it crashes my bot bruh
well i am to lazy to do that
thats a bad idea 🤔
Fail
also, spamming logins could get you banned from the api
i thought it is just warn
So how do I check for an embed?
if(!message.content) should do iirc
it doesnt matter if theres an embed, just matters if theres content
@white drum check if message.author exists, otherwise return
if(!message.author) return
you can also throw content in there
if(!message.author || !message.content) return
that is if you only want to log text
Here is what I'll add,
if(!message.author) return;
if(!message.content) return;
you could just if(!message.author || !message.content)
Does anyone know how to upload code to github via the git app/console thing, My bot has a long file name (SpiderBot Command Handler), And I can't cd there because to many arguments, Ive tried doing-it-like-this and using the package name (SpiderBot2)
you cant cd there?
No
epic
thanks
Also i have one more question about github if someone could answer, how do i censor out my token in my config? Do i change it when running git init or something
you should have an env var, or have a dedicated config file for your token, with the file listed in gitignore
Okay thanks
you can just use a .gitignore file
some people want public repos.
if I have an array of json objects how would I use indexOf to get the position of an object in that json object to get the array position
i public my old bot in my github profile
cuz it is such of big mess
and ppl won't understand it
LoL
kinda like
const array = []
array.push({ username: 'Karl' })
array.push({ username: 'John' })
//How do I get the index of the username property 'Karl' in the array
username in my case would be unknown ofc
a find/filter function seems to be what you want
I mean, manually iterating over the array works too
If you only need to find one occurrence, just exit the loop 
Isn't it possible to use indexOf({username: 'Karl'})?
yes it is
array#indexOf({username: 'Karl'})
what if it is array.push({ username: 'John', goal: 'Some other object stuff' })
will it still work
lol
You would have to put in the whole object afaik.
which in this case, if you have an array of user objects and you want to find the index of one by its username, id use findIndex.
or, if you want the object itself, just find.
I just need the position
then findIndex, if you dont have the whole object and are just searching by a property.
some people want public repos.
@solemn latch me included
I just did
const checkQueuePosition = element => element.username === username;
queue.findIndex(checkQueuePosition)
uses mineflayer
has spam detection etc.
im just adding a command queue rn
so you can't cancel the command someone is doing rn
unless thier goal has been finished
wanted to ask how to get the position cuz I will add it so you can see ur position too
in the "command queue"
floods chat
how can i calculate a concept like if the user has been over .premiumSinceTimestamp for 1 month.
Save the timestamp
And check if it was older than one month ago
date.now() - member.premiumSinceTimestamp > 1month
spoonfeeding
psh, thats not copy paste 🤔
Do you have a suggestion for a bot name?
Uhhhh
what is the bot about
Carrot
the only thing thats copy paste is date.now() everything else is placeholders 🤔
Moderation
Mod
mod bot
name it MOODBOOT
or just give it some person's name and call it a day
lol
like Rose
thanks for suggestions
Roosemon
how important is it to learn mathematics to get successful in programming? I am thinking of reading something about lambda
know the basics at least
Depends on what you are going to use programming for
Stuff like simple Discord bots won't require advanced maths like calculus
how important is it to learn mathematics to get successful in programming? I am thinking of reading something about lambda
@midnight blaze 8th grade math is a necessity for pogeyramming
knowing concepts of math i think is pretty important.
knowing how to do complex math, mostly isnt.
but, as always, it depends
Code: Python
Issue: CommandNotFound: Command “join” is not found
Code:
class Music(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def join(self, ctx, *, channel: discord.VoiceChannel):
"""Joins a voice channel"""
if ctx.voice_client is not None:
return await ctx.voice_client.move_to(channel)
await channel.connect()
bot.add_cog(Music(bot))
Please tag me in your response
Is the cog loaded
@hasty mulch 🥄
Oh
anyone here who learnd the theory of lambda?
Are you creating that class in the main file?
A lambda is just an anonymous function.
@sudden geyser yes, but there is a large amount of theory behind it
for me the most useful math skill ever is the percentage formula. you can do almost everything with that
@hasty mulch that's the best way to ask for help no need to ask for permission or anything just send the code explain your error and wait for someone to reply
thanks for being a good boi
@quartz kindle xD what about probability?
otherwise basic trigonometry is also good to know, quite essential when dealing with canvas
for me the most useful math skill ever is the percentage formula. you can do almost everything with that
@quartz kindle the most useful math formula is not doing algebra or log functions or that shit but learning only that stuff about math which you ACTUALLY USE in daily life
Honestly, try to slap a few prints right after the add_cogs to see if they load properly
But it rather seems that you are loading the cog and silencing errors
Should I move the add_cog up?
who studied programming in a university?
I am sure you guys have to know a lot of stuff
i've never used log functions, but i use the percentage formula in almost everything
percentage formula? what do you mean by that? That doesnt seem very hard
date.now() - member.premiumSinceTimestamp > 1month
@solemn latch How do I define 1month
I was watching an interview between a dev and a big company and they asked them a lot of mathematics questions about an actually very simple algorithm
its not hard, its one of the most basic things in math, but its one of the most useful ones ever, you can use it for a shit ton of things
1 month would be the number of seconds in a month(30 days if you wanna be lazy)
45 = 80
? = 100
Should I move the add_cog up?
@hasty mulch not necessarily
@slender thistle Music not defined. I have a feeling I should pip import music
finally got mysql to work
top to bottom
I have the cog loaded before the bot came online
@quartz kindle is 56,25 100%?
Unless that is the on_ready thing
Can you slap a print(bot.cogs) in the on_rsady event
if the number 45 is 80%
or in a command
Yeah, one sec
@midnight blaze yes
i never said it was hard
ok
i said it was the single most useful formula in maths
I thought it must be more hard for some reason
with a lot of uses
well, I guess, I understand that
Loading now, shiv
I was always good with %
you can use it for more complex stuff
Music is loaded, gonna try the command
for example, i use it all the time when working with canvas
to resize things
to recalculate scaling
etc
How do i center a div in HTML?
also for responsive web design
@slender thistle Command “join” not found
How do i center a div in HTML?
@fervent goblet CSS style margin
...???
wait not that
Try commenting out the command function body and do something as simple as sending a message
Wait
style="text-align: auto/left/center/right;"
Just trying to get it x
It says “Ignoring exception in command None”
its not text tho
Is that where the error is, @slender thistle ?
@quartz kindle
if you put 100 instead of 45?
well, if 45 is 80%
what % is 100
It looks to me it is around 177%
since 56 is 100%
but no clue
maybe I am talking bs
56.25 is 100 yes
the hell
and now, you want to know what % is 100
id say 45/80. I get the number of for 1%
like if 45 is 80% then 100 is how much %?
I would do it like that. 45/80, I get the number for 1%
and after that it should be easy to get 100
Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command “join” is not found
@slender thistle
you cross multiply then divide
a = z
b = x
b * z / a = x
x * a / z = b
z *b / a = x
you're braining my hurt
that sounded harder than it is lul
And waiting for Shiv to reply...
Can you send your full code
I still think it is 177%
am I wrong?
I was trying to understand your equations, but hmm
yes its 177.7777
Yeah, gotta load Discord on my Linux for that and hopefully not crash it
Reeee
import discord
from discord.ext import commands
from discord.ext.commands import Bot
import asyncio
import youtube_dl
bot = commands.Bot(command_prefix='-')
@bot.event
async def on_ready():
print('Successfully logged in as {0.user}, Running Verison 0.0.0.3'.format(bot))
print('Cogs loaded:')
print(bot.cogs)
async def on_message(message):
if message.author == bot.user:
return
@bot.command()
async def test(ctx):
if ctx.author.id == 222766150767869952:
print('Test')
await ctx.send("Success!")
pass
class Music(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def join(self, ctx, *, channel: discord.VoiceChannel):
print('Connecting...')
"""Joins a voice channel"""
if ctx.voice_client is not None:
await ctx.send("Joining...")
return await ctx.voice_client.move_to(channel)
await channel.connect()
print('Connected!')
@bot.command(name='ping')
async def _ping(ctx):
print('Ping!')
await ctx.send(f'Pong! Took **{(bot.latency * 1000)}**ms')
pass
bot.add_cog(Music(bot))
print('Loaded music cog')
bot.run('[REDACTED]')
``` @slender thistle
@quartz kindle xD sry for asking, are you working as a dev?
Uhm
uhhh
Do you uhh
see the unnecessary indents there
for your join command
You nested it into the init function
Alright, I’ll bounce it to the front

You need to add the ability for the bot to process commands
Since you have an on_message event
Ok
on the on_role_edit event
it sends like all roles have been edited
anyone know how to fix that?
using python
@hasty mulch
@earnest phoenix So, write exactly await bot.process_command(message) or replace message with the commands?
And where would it go?
The first thing you said
Ok
Literally on the on_message event you already have in ur code
Ok
punten
if (!cooldowns.has(command.name)) {
cooldowns.set(command.name, new Discord.Collection());
}
const now = Date.now();
const timestamps = cooldowns.get(command.name);
const cooldownAmount = (command.cooldown || 3) * 1000;
if (timestamps.has(message.author.id)) {
if (timestamps.has(message.author.id)) {
const expirationTime = timestamps.get(message.author.id) + cooldownAmount;
if (now < expirationTime) {
const timeLeft = (expirationTime - now);
return message.reply(`please wait ${timeLeft.toFixed(1)} more second(s) before reusing the \`${command.name}\` command.`);
}
}
}
timestamps.set(message.author.id, now);
setTimeout(() => timestamps.delete(message.author.id), cooldownAmount);
@earnest phoenix
async def on_message(message):
if message.author == bot.user:
return
await bo.process_command(message)
``` Confirm?
I cant speak english:)))))
@bot.command()
async def test(ctx):
if ctx.author.id == 222766150767869952:
print('Test')
await ctx.send("Success!")
pass
Also, this pass statement is useless, remove it
Ok
@torn zinc go and learn it then
Indent the last line by one tab & yes @hasty mulch
OH! And add a "T" at the end!!!!
on the on_role_edit event
it sends like all roles have been edited
anyone know how to fix that?
using python
@midnight blaze Speak Indonesiaa:) i from indonesian.
Yee
@earnest phoenix REEEEEEEEEEEEEEEEEE
discord.ext.commands.errors.CommandNotFound: Command "join" is not found```

I'm confused by ur code btw @hasty mulch
I hope your business works well
How do I run another js file in nodejs?
Why do you have a cog setup yet some of the code isn't in the cog? Is this the main file or what?
This is
I have an index.js file but I want to run another core file
teach english pliss:v🤣
Cause I don’t know how to load other scripts
@gritty bolt you want to "run" it, or you want to include/require it?
Run it
DAHLAH GA PAHAM AKU SAMA BAHASA KLEN
running means executing it as a separate process
@quartz kindle I guess your business is probably about web and stuff, since you are an expert in js
thats what I want to do
@sinful belfry Little help here with this guy? The one with all gibberish
@midnight blaze not really lul, its about Astrology
This should help & it'll clear up some issues for you I imagine https://gist.github.com/EvieePy/d78c061a4798ae81be9825468fe146be @hasty mulch
hello i need code user
@torn zinc #memes-and-media for other languages please

@earnest phoenix Ty, I’ll look into it and get back
you could also eval(require('fs').readFileSync('yourfile.js', 'utf-8')) but like why
How do I disconnect my bot from the VC? Or stop my bot from playing anything? I get an error when I use this code:
if (message.content.startsWith(`${prefix}stop`)) {
var server = servers[message.guild.id];
console.log(server);
if (message.guild.voice.channel) {
for (var i = server.queue.length - 1; i >= 0; i--) {
server.queue.splice(i, 1);
}
server.dispatcher.end();
message.channel.send("Ending the queue. Leaving the voice channel...");
console.log('Stopped the queue!');
}
if (message.guild.connection) message.guild.voice.channel.disconnect();
}
Error:
https://hatebin.com/osjosjqseu
Printing out server:
{ queue: [ 'https://www.youtube.com/watch?v=9Va88Kt0NN0' ] }
Server is this:
var server = servers[message.guild.id];
Error:
poll_message = await channel.get_message(id)
AttributeError: 'TextChannel' object has no attribute 'get_message'
Code:
poll_message = await channel.get_message(id)
Help!
any decent java compilers that i can use for free 
Oh ok!
any decent java compilers that i can use for free :thinking_derp:
@thick gull Yes, Javac

@simple stump to leave vc just do bot.member.voice.channel.leave();
i think it's client.voice.channel.leave()
or that
if (!msg.member.hasPermission("SEND_MESSAGES")) return message.channel.send("test");
//let channel = message.mentions.channels.first() || bot.guilds.cache.get(message.guild.id).channels.cache.get(args[0]) || message.guild.channels.cache.find(r => r.name.toLowerCase() === args.join(' ').toLocaleLowerCase()) || message.channel;
try {
const messages = await channel.messages.fetch({ after: 1, limit: 1 });
const message = messages.first();
const embed = new MessageEmbed()
.setColor(autimatic)
.setThumbnail(message.author.displayAvatarURL({ format: 'png', dynamic: true }))
.setAuthor(message.author.tag, message.author.displayAvatarURL({ format: 'png', dynamic: true }))
.setDescription(message.content)
.setTimestamp(message.createdAt)
.setFooter(`ID: ${message.id}`)
.addField('❯ Jump', message.url);
msg.embed(embed);}
catch (e){
return msg.channel.send(e)
}
TypeError: Cannot read property 'fetch' of undefined
client.voice shouldn't exist either
Because there can be multiple voice connections
fetch is giving an error what should I do
what is channel

dont you mean message.channel.messages.fetch
async (bot, msg, channel, args) => {
why is that an argument
you can just use async (args, msg) => { and use msg.channel and msg.client
lol
or const {channel, client} = msg
I first defined it that way. then I defined it as let = channel
let channel =
lmao
hot tip: always use const whenever possible, if you dont plan on reassigning to the variable
hey
hello
my bot invite tracker bot working but
some times dont write text
like that
who can help me
i wanna fix it
?!
?!
@misty sigil ??
@misty sigil How do I put it in PM2
you literally have not provided me any context
@earnest phoenix its a process manager
@earnest phoenix ?
who can help me
if i can
my bot invite tracker bot working but
[22:40]
some times dont write text
down text = mee6 up text = my bot
HELP!!!
@bot.command(pass_context=True)
async def endpoll(ctx, id):
channelname= ctx.message.channel
poll_message = await channelname.fetch_message(id)
if not poll_message.embeds:
return
embed = poll_message.embeds[0]
if poll_message.author != ctx.message.author:
return
if not embed['footer']['text'].startswith('Poll ID:'):
return
unformatted_options = [x.strip() for x in embed['description'].split('\n')]
opt_dict = {x[:2]: x[3:] for x in unformatted_options}if unformatted_options[0][0] == '1'
else {x[:1]: x[2:] for x in unformatted_options}
# check if we're using numbers for the poll, or x/checkmark, parse accordingly
voters = [ctx.message.server.me.id] # add the bot's ID to the list of voters to exclude it's votes
tally = {x: 0 for x in opt_dict.keys()}
for reaction in poll_message.reactions:
if reaction.emoji in opt_dict.keys():
reactors = await ctx.get_reaction_users(reaction)
for reactor in reactors:
if reactor.id not in voters:
tally[reaction.emoji] += 1
voters.append(reactor.id)
await ctx.send('Results of the poll for "{}":\n'.format(embed['title']) + \
'\n'.join(['{}: {}'.format(opt_dict[key], tally[key]) for key in tally.keys()]))
This is my code. When i do the cmnd, it shows no error message, but it also doesn't say anything on the server
@misty sigil Do you have a code to change the prefix bot?
aye but no 
Ok, how do I keep messing up?
import discord
from discord.ext import commands
from discord.ext.commands import Bot
import asyncio
import sys, traceback
bot = commands.Bot(command_prefix='-')
initial_extensions = ['cogs.central-music'
]
@bot.event
async def on_ready():
print('Successfully logged in as {0.user}, Running Verison 0.0.0.3'.format(bot))
print('Cogs loaded:')
print(bot.cogs)
if __name__ == '__main__':
for extension in initial_extensions:
bot.load_extension(extension)
async def on_message(message):
if message.author == bot.user:
return
@bot.command()
async def test(ctx):
if ctx.author.id == 222766150767869952:
print('Test')
await ctx.send("Success!")
pass
class Music(commands.Cog):
def __init__(self, bot):
self.bot = bot
@bot.command(name='ping')
async def _ping(ctx):
print('Ping!')
await ctx.send(f'Pong! Took **{(bot.latency * 1000)}**ms')
pass
bot.run('[REDACTED]')
``` @earnest phoenix What am I doing wrong? `ModuleNotFoundError: No module named 'cogs'`
HELP!!!
@bot.command(pass_context=True)
async def endpoll(ctx, id):
channelname= ctx.message.channel
poll_message = await channelname.fetch_message(id)
if not poll_message.embeds:
return
embed = poll_message.embeds[0]
if poll_message.author != ctx.message.author:
return
if not embed['footer']['text'].startswith('Poll ID:'):
return
unformatted_options = [x.strip() for x in embed['description'].split('\n')]
opt_dict = {x[:2]: x[3:] for x in unformatted_options}if unformatted_options[0][0] == '1'
else {x[:1]: x[2:] for x in unformatted_options}
# check if we're using numbers for the poll, or x/checkmark, parse accordingly
voters = [ctx.message.server.me.id] # add the bot's ID to the list of voters to exclude it's votes
tally = {x: 0 for x in opt_dict.keys()}
for reaction in poll_message.reactions:
if reaction.emoji in opt_dict.keys():
reactors = await ctx.get_reaction_users(reaction)
for reactor in reactors:
if reactor.id not in voters:
tally[reaction.emoji] += 1
voters.append(reactor.id)
await ctx.send('Results of the poll for "{}":\n'.format(embed['title']) + \
'\n'.join(['{}: {}'.format(opt_dict[key], tally[key]) for key in tally.keys()]))
This is my code. When i do the cmnd, it shows no error message, but it also doesn't say anything on the server
Use prints @earnest phoenix
wdym?
🤔 are you just pasting your code every time someone else asks for help
nope
two times people asked for help and just as they did you posted a wall of text
If you have questions, ask the questions and wait for someone who can answer to help you.
@sinful belfry Your opinion on this?
you know editing does work
If I do prints, then it will print in the code place
Not on the channel
But it doesnt even print anything
and there is no error code
idk why
Then your issue is at the start
@earnest phoenix you should wait for someone to help
Ok
if your question gets lost after some time, just link your earlier message
who can help me 😦
ok
but not every minute or so
sry
-ask2ask @steady wharf
@steady wharf
Don't ask to ask.
Just ask your question, it wastes time if you say "i need help" or "can someone help me?" instead of just saying what the problem is. Save your time and other people's time and just ask the question.
Please read https://dontasktoask.com/ for an explanation on why this is an issue.
-help
can u send ur code as text rather than an image?
i sent my image and problem
it is easier to help when you send as text
such as with hastebin or something
images are difficult to see when there is that much code in them
Is the problem ctx.message.server.me.id?
nope
my bot invite tracker bot working but
[22:40]
some times dont write text https://cdn.discordapp.com/attachments/272764566411149314/750077756670476429/2.PNG https://cdn.discordapp.com/attachments/272764566411149314/750077755051475084/1.PNG
down text mee6
up text my bot
please help me
c o d e
you wanna code?
That looks like a bot from GitHub lol
its beautiful
i need to see the code
okey
and the relative errors
client.guilds.forEach(g => {
g.fetchInvites().then(guildInvites => {
invites[g.id] = guildInvites;
});
});
});
yea no
fuck this
what
you do not know how fucking bad that is
can you fix it?
you do not know how fucking bad that is
@misty sigil how is that bad
wait you do
Yes
fUCk im an eejit
Because bots cant track invites directly
ok right im off to not be a fucking eejit
you have to save the invite list all the time

it seems that discord just isn't firing the event from what i can see
Hi
hi
I have a specific problem
i feel like fetching invites that way is still a bad idea, and using promise.All is a better choice
who can fix it?
Quick question, I dislike the way titanbot and Widgetbot handles the things I want done. Is there a easy way to get the messages of a discord text channel to translate into displaying on a website? No chat interaction whatsoever only displaying messages'
@misty sigil you will fix it?
idk im not a magik man
i know but if you will fix it i will wait if you dont try to fix it i will search it
Hi
Quick question, I dislike the way titanbot and Widgetbot handles the things I want done. Is there a easy way to get the messages of a discord text channel to translate into displaying on a website? No chat interaction whatsoever only displaying messages'
@inner merlin Yeah, you could have a bot that when the message event is fired, make an api call to the website to add it to the page, or update a database, and the website will refresh
Danke
@faint prism
Can I get some feedback on this table?
CREATE TABLE `suggestions` (
`id` INT NOT NULL AUTO_INCREMENT,
`user_id` BIGINT NOT NULL,
`text` VARCHAR(256) NOT NULL,
`timestamp` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
)```
A few ways to approach it 🙂
Epixio for reference, what language are you writing in (I know it's SQL, but what lang to write your bot in).
I don't know if saving user_id as a BIGINT is the right way to go.
it's a 64 bit integer
which is the highest snowflake size
should i save as a VARCHAR(18)?
i'd store it as a string ngl
The ID is large for JavaScript so it usually truncates the number from the last time I tried it.
i'd store it as a string ngl
@misty sigilHard to index by a string lol
I take that back
https://stackoverflow.com/questions/517579/strings-as-primary-keys-in-sql-database
why
why would i need to sort guilds
wait
oh yeah it should be numeric
because its the PRIMARY KEY
So when you query the table and get it back user_id will be a string
I store IDs as bigint
But I also had to add this to my mysql connection options:
bigNumberStrings: true,``` ¯\_(ツ)_/¯
with nodejs?
lol
yes nodejs
It kept rounding the IDs
😳
after adding those options it didnt do that anymore
module.exports = mysql.createPool({
host: $config.db.host,
user: $config.db.user,
password: $config.db.pass,
database: $config.db.name,
decimalNumbers: true,
connectionLimit: 10,
charset: "utf8mb4_unicode_ci",
supportBigNumbers: true,
bigNumberStrings: true
});```
this is what i use
i mean, bigNumberStrings is probably useless for me since i use bigint
user: process.env.DB_DISCORD_USER,
password: process.env.DB_DISCORD_PASS,
database: process.env.DB_DISCORD_NAME,
dateStrings: true,
supportBigNumbers: true,
bigNumberStrings: true,
charset : 'utf8mb4_general_ci'```
Similar here
I dont remember what I needed those for
if i use a timestamp will i be able to use it like Date.now()
ye i use unix time
charset : 'utf8mb4_general_ci'
@nimble kiln you should useutf8mb4_unicode_ci
Any reason why?
general_ci is only 3 byte characters, so some unicode characters get chopped off including some emojis i believe
unicode_ci is 4 byte
oh, mhmm
the performance impact is minimal now, general_ci is from when cpus sucked lol
by whole database is general_ci tho 👀
I'm trying to make a queue system for my new music bot, however, the queue is always one song. I try to add something to the array, but a new song just plays (the connection.play(); is what controls playing a new song). I just want to add a new song to array, rather than deleting it.
Code:
var server = servers[message.guild.id];
const channel = message.member.voice.channel;
if (!message.member.voice.channel || channel.join == null) {
message.channel.send("Channel doesn\'t exist or you're not in a voice channel!");
} else {
console.log(server.queue);
server.queue.push(args[0]);
if (/*server.queue[0] != "" && */server.queue.length = 1) {
channel.join().then(function(connection) {
connection.play(ytdl(args[0]));
})
} else {
console.log("ok zoomer thing is not empty");
server.queue.push(args[0]);
}
/*
channel.join().then(function(connection) {
connection.play(ytdl(args[0]));
})
*/
}
Full code: https://hatebin.com/mrqsuzpfnc
32bits 👀
rip
Well I dont mind some unicode characters being cut off
console.log("ok zoomer thing is not empty");
@simple stump I respect this
Well I dont mind some unicode characters being cut off
@nimble kiln Intentionally truncating data 😖
SqliteError: table starboard has 17 columns but 15 values were supplied
i thought you didnt need to specify all columns to insert a row? cant some be null?
I made prio.2b2t.dev yes
is that the official one
Not the queue itself
console.log("ur ip is:");
timestamp**
client.on('message', async msg => {
let commandQuery = msg.content.split(prefix);
switch (commandQuery[1].split(' ')[0]) {
case 'help': helpCommand(msg); break;
case 'short': replyShortAnswer(msg); break;
case 'full': break;
default: break;
}});
Am I doing it right? 🙂
-prefix:command- -args-
wa:short something
😛
exactly holy
i dont understand sh**
I was thinking about refactoring that
no shit
watch codelyons tutorials
@faint prism
no shit
@dusk vault sherlock
you can abstract d.net's command logic, it's going to be a lot easier since reflection in js is just... well dictionary lookups lol
In another bot i made I did:
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;
}
no
client.on('message', async msg => {
let text = msg.content;
const prefix = '!';
let matches = false;
const ping1 = `<@${client.user.id}>`;
const ping2 = `<@!${client.user.id}>`;
if (text.startsWith(prefix)) {
text = text.slice(prefix.length);
matches = text.trimLeft() == text;
} else if (text.startsWith(ping1)) {
text = text.slice(ping1.length).trim();
matches = true;
} else if (text.startsWith(ping2)) {
text = text.slice(ping2.length).trim();
matches = true;
}
if (matches) {
const args = text.split(/ +/);
if (!args.length) return;
const name = args.shift();
// Do stuff with name and args here.
}
});```
@faint prism
you're welcome
no need to ask twice
const { GistBox } = require("gist-box");
const Box = new GistBox({
id: process.env.GIST_ID,
token: process.env.GH_TOKEN,
});
const Discord = require("discord.js");
(async () => {
const client = new Discord.Client();
client.login(proce_ss.env.BOTTOKEN);
const GUILD = process.env.SERVER_ID;
client.on("debug", console.log);
client.on("ready", async () => {
if (!client.guilds.cache.has(GUILD))
throw new TypeError(
`I am not in the guild ${GUILD} | (${client.user.tag})!`
);
const SERVER = client.guilds.cache.get(GUILD);
await Box.update({
content: `👉 ${SERVER.name}'s stats! 📊 Logged in as ${client.user.tag}\n🐍 Owner: ${
SERVER.owner.user.tag
}\n🤷♂️ Users: 💁♂️ Members: ${
SERVER.members.cache.filter((x) => !x.user.bot).size
} 🤖 Bots: ${
SERVER.members.cache.filter((x) => x.user.bot).size
} 🔢 Total: ${SERVER.members.cache.size} \n#️⃣ Channels: 📚 Text: ${
SERVER.channels.cache.filter((x) => x.type == "text").size
} 🎤 Voice: ${
SERVER.channels.cache.filter((x) => x.type == "voice").size
} 📦 Categories: ${
SERVER.channels.cache.filter((x) => x.type == "category").size
}\n📣 News channels: ${
SERVER.channels.cache.filter((x) => x.type == "news").size
} 💵 Store channels: ${
SERVER.channels.cache.filter(x => x.type == "store").size
} 📨 Roles: ${SERVER.roles.cache.size}`.trim(),
filename: `📊 Discord server stats.txt`,
});
await process.exit(0);
});
})();
client.login("");```
server info command for peeps who need it
you're welcome
@dusk vault the only added value I see is is that it will allow mentions instead of the prefix. Correct?

if it loads without the css, go to the top.gg homepage, then reload the api page.
not sure if they fixed the issue when attack mode is on
@dusk vault the only added value I see is is that it will allow mentions instead of the prefix. Correct?
@faint prism and its not the shittiest command handler ive ever seen

Idk py unfortunately
@dusk vault What exactly is wrong with it? It parses the input quickly and as expected
It's just splitting a string, and using the expected format by indexes though
um any help
node:4) UnhandledPromiseRejectionWarning: TypeError: message.client.get is not a function```
How do I change my bot’s status to DND?
@hasty mulch change_presence(status=discord.Status.dnd)
An enum
@sharp thicket what are you trying to do
message.client.get is not a function message.client.get isn't a function
a nice moment where english is definitely not ambiguous
client doesn't have a get method
yes
using pythonm anyone have an example of prefix thing?
You're both wrong, it's 99.7%.
ie, 3 standard deviations
fucc
lmao
make it 99.9%

tim shiv cry me and auger, thats the team
100 - 1E-99999999

%
none of us know what we're doing
me: cries in spent a year doing this and coding for half my life
EXCUSE ME
im pretty sure 99% of certified devs know what they're doing
TS sir
then maybe 30% of verified devs
superset superiority syndrome
can i bribe @slender thistle to get me certified dev? 
so thats why i still have a white name
red names maybe 50% know what they're doing
how do i apply to join the 'js team'
learn js
i think i'm halfway decent
learn js and spend 90% of your daily time here helping people in order to get an excuse for your procrastination, thats how you join the team
dblpy is working fine so I'd say there's still hope
lol is there a test
yes
if only i could make a living from helping people on discord
how much is it worth my grade
know how proxies work 
if only, Tim... 
any chance yall' be doing a certificate again soon?
Soon™️ is as close as possible because it's still being reworked
hey shivaco i have a question
is it actually being reworked tho?
Im officially signing up for beta, wink wink
||Shiv: -ask2ask||
Well, it's probably not top priority as of currently
so if i have a bot that has general purpose features, but still has one or more powerful unique features, it still cant be accepted as applicable for certification?
so at least its not 100% abandoned
petition for helper role for those who contribute a lot in this channel too
thats good to hear
Requirements for certification are unknown, I can't give you a definite answer @dusk vault
requirements for certified dev: be human (optional)
okay nvm my question never got answered
but eh
why do I get
TypeError: neko is not a function```
I did: ```css
module.exports = function neko(command, message, choices){ stuff}```
I can only think of one reason, I messed up in pathway but it doesn't give me that error

i still need help
@earnest phoenix #memes-and-media please
is it just me or is sqlite being funky
its just you
how do i get a value from this
using discord.js
const https = require('https')
const options = {
hostname: 'financialmodelingprep.com',
port: 443,
path: '/api/v3/quote/AAPL?apikey=demo', //b186ef33ed7c7aee4fa9226a0d7f257f
method: 'GET'
}
const req = https.request(options, (res) => {
res.on('data', (d) => {
process.stdout.write(d)
})
})
message.channel.send(`${req.symbol}'s stock value is ${req.price}`)
req.on('error', (error) => {
console.error(error)
})
req.end()``` here's the code
so the first time i tried it messed up the values, the second time it was fine except for one
why is message "0.0" i never
wait forgot
this
tim save me

https://cdn.discordapp.com/attachments/272764566411149314/750135304588886038/unknown.png bruh is this called a table
or am i saying it wrong
what is that
Hi,anyone know how to store data in a file so multiple commands can see it is that possile as im making music commands
that's a json object
reminds me
@quartz kindle sorry but do you usually enable auto_vacuum or vacuum at all?
here
@errant perch the value is only available inside the data event
it doesnt exist outside
@grizzled raven in sqlite? nope
oh
in the vote and queue files i just have new Map();
i mean, i never set up any vacuum option, idk if it has a default one
dont think so
Hi,anyone know how to store data in a file so multiple commands can see it is that possile as im making music commands
use a database
so yeah tim do you know whats happening with text being set to "0.0" when i pass null?
Why the button looks like it's floating
@grizzled raven how are you columns defined?
@ember lodge i don't know html or css but maybe define a position for the button?
do you need the whole statement?
is not that :/
well thats from a sqlite viewer thingy which is probably using select, but i'll try myself
which sqlite lib are you using?
or am i saying it wrong
@errant perch it's an array of objects
most likely some weird type coalition going on
also keys tend to get switched for whatever reason and its inconsistent
the column expects text, do it doesnt understand what null is and tries to convert it
this conversion can be done at library level or at sqlite level, not sure which one is the culprit
hm
the only way to avoiding it is to avoid typing mismatch
well other nulls actually get saved as null
for example if the column is text, just store "" instead of null
because you cant control how automated type conversions happen, its always better to stick to the correct type
its just weird how one is fine and one is 0.0
and its 0.0 and not 0 so thats even weirder
but that could be sqlite
could also be the library
but how can one be null and one be 0.0

okay i guess ill just manually do that
but then
so i set stuff like this
but then it gets saved like this though
seems to be in the order of the object but i didnt change it for 2 and 3 and their different
arent you missing the columns selection?
hm?
INSERT INTO starboard (messageID,guildID,...) VALUES (@messageID,@guildID,...)
i read the docs and better-sqlite3 said i can bind parameters like that, https://github.com/JoshuaWise/better-sqlite3/blob/HEAD/docs/api.md#binding-parameters, db.prepare('INSERT INTO people VALUES (@firstName, @lastName, @age)')
but maybe that could fix it, i'll see
oh thats why sqlites asking me for all columns to be provided
that makes sense
i've always used this format INSERT INTO themes (id,name,owner,data) VALUES (?,?,?,?)
never had issues
just thought i should do it that way, didnt realise that both ways work
and that that way is for all values and the column thing is just for inserting some
that seemed to fix the column placement problems AND the message being 0.0 so thanks
how do i get a value from a array
it returns as undefined
show code
const https = require('https')
const options = {
hostname: 'financialmodelingprep.com',
port: 443,
path: '/api/v3/quote/AAPL?apikey=demo', //b186ef33ed7c7aee4fa9226a0d7f257f
method: 'GET'
}
const req = https.request(options, (res) => {
res.on('data', (d) => {
process.stdout.write(d)
})
})
message.channel.send(`${req[1]}'s stock value is ${req[2]}`)
req.on('error', (error) => {
console.error(error)
})
req.end()```
this is the array if that helps
does member.roles.has require cache?
@errant perch try sending message after req.end and see if it helps
cannot read property of name undefined
what are you console.logging
req
do console.log(res); console.log(req[0])
ok
@errant perch the data you want only exists inside the data event
outside there is nothing
req does not contain the data
// req is a request object, it controls the request process, but does not contain any data
const req = https.request(options, (res) => {
// the request object returns a response object, which contains a data stream from where you can read
res.on('data', (d) => {
// here we read data from the stream, at this point the data you want exists in the "d" variable
// this data only exists here, nowhere else
process.stdout.write(d)
})
// there is no data here
})
// there is no data here
wait is it d you're logging and showing me?




