#development
1 messages · Page 1241 of 1
.conversate for crying out loud
.reply
@flint yewjs Message.prototype.reply()doesn't exist on commando
Ngl i wish people who didnt know js or djs would be yeeted from here
@earnest phoenix then i would have never been encouraged by awesome people here that i'm not a dumbass and i can learn programming and 3 months later i wouldn't have been here with a bot with over 2500 lines of code
.exchangeCommunitcation()
@earnest phoenix yea not working
Hmm, can you show your new code in hastebin
.contributeToChannelActivityViaAMessage
2500 lines of code for a discord bot, bad.
.assertAPIDominanceWithANewMessage
Number of lines don't really say that a bot is good or bad
More lines doesnt mean your bot is better
@earnest phoenix whatever you say i'm gonna literally destroy the server if you just kcik out noobs
its either 8 or 80
its either absolutely shit/basic or well/complicated/optiized code
.putsOnAAPIfromDiscordGatewayWithANewMessageObjectWithContent
One-liners for 2D lists are pain
@earnest phoenix https://hastebin.com/piheqedixo.js that the code
.sendAJSONStringifiedPayloadToDiscordAPIThatMayContainContentOrEmbedOrSomeOtherAcceptableProperty()
@flint yew You must have executed your command in an unordered way of parameters
That args is message and message is args
Can you show how you execute the commands

In your main file or whatever
and i have error
@earnest phoenix What's the "error"
<channel>.send()
also, method
not property
did u define channel?
ur compiler disagrees
client.on('channelCreate', async (channels) => {
const options = await config.get(channels.guild);
const ChannelIDLogs = options.logsChannel;
let embed = new MessageEmbed()
.setTitle('Channel Created!')
.setDescription([
`**-> Channel Name:** ${channels.name}`,
`**-> Channel ID:** ${channels.id}`,
])
.setColor('GREEN')
.setTimestamp()
.setFooter('Time event:')
.setThumbnail(client.user.displayAvatarURL({ dynamic: true }));
const channel = client.channels.cache.get(ChannelIDLogs);
channel.send(embed);
});
@earnest phoenix As you defined channel here, it wasn't able to find that channel from the bot's cache
Make sure the id is correct
like i have more then 150 commands
Also why to resolve a non promise function?
after some updates got many errors
try porting everything to TS and then come talk tome
await config.get(channels.guild) doesn't return a promise @earnest phoenix

No need to await
Js:
i run code;
Ts:
Nooo you cant do that!throw 872 errors!
Js: I run code without inspection to let the developer know what's wrong so they should get along with this and get used to it
Ts: I just throw errors if i see a missing particle in code, or just a semicolon, but it's better to resolve the errors before running them
Ts is better, change my mind
For small scripts JS is fine
Find me that single message when i said TS is useless
And I mean, generally if you aren't an idiot, JS is fine. TS just helps you prevent shit with types
as a wise man once said, 'Would you rather have silly development errors or insanity inducing bugs in production?'
Why not both?

That way you show authenticity
Oop-
I said TS is just js with Type Guards, if you not be able to resolve and rewrite a typing correctly, you're stuck
What more should I add?
https://cdn.discordapp.com/attachments/750091983191670805/754981034172481596/profile.png
why not 300 iq?
just do any on everything and then claim to be a cultured man. Just like people who use ARCH linux with a UI
Add badges if you can though

hi
Slap dynamic and any everywhere
just do
anyon everything and then claim to be a cultured man. Just like people who use ARCH linux with a UI
@opal plank lmao imagine using two ` for inline code blocks
@livid breach do you need help with anything?
just do
anyon everything and then claim to be a cultured man. Just like people who use ARCH linux with a UI
@opal plank I mean some things throw type errors which their typings weren't written correctly, or as you wanted it to work so you gotta rewrite the typings
More work
But less errors, but stuck if you can't
i was joking of course, its bad to have any's floating around
some stuff do need any though
good luck typing an interface with every single country out there that can come from an api request
My type annotations genuinely go fuck-all with dictionaries and lists

good luck typing an interface with every single country out there that can come from an api request
@opal plank That's the problem with TS
you end up having to do key:['string']:something
good luck typing an interface with every single country out there that can come from an api request
@opal plank challenge accepted and declined at the same time cuz the function was async
you won't get it
what?
If you're a experienced developer and can write code with mostly no errors at all, JS is completely fine than TypeScript
what does async have to do with this?
you can code on notepad too,but having some extra tools help,dont they?

I mean they do but TS isn't related to this, is it
its strong typed javascript,basically
it gets compiled to js either way
transpiled, i should say
Wait does TS even count missing semicolons as errors?
vsc is god
agreed
Imagine a ported android version of vsc
Bruh
mobile coding sucks
hail smartphone coding
(mobile means that shitty filp phone all teens used to use)



mobile coding sucks
hail smartphone coding(mobile means that shitty filp phone all teens used to use)
@earnest phoenix Excuse me you can't code on those can you
I mean the flip phones that were made a long time ago
Lmao
worst case scenario you send an sms with your code
gives me shivers to even think about doing that

Sms with codeblocks would actually be kinda cool
code with a dial telephone, use 1 and 0 to write in binary if you truly despise your own life
Or just make a compiler out of it, to attach a keyboard to it for it to understand human readable code

make async code in binary using a dial telephone

i think that goes way beyond self-harm, if you are mad enough to attempt
What does use strict mode in Js even mean i wonder
some keywords arent allowed
Such as
What does
use strictmode in Js even mean i wonder
@earnest phoenix strict mode?I thought it was obvious
"use strict";
// Code```
MDN is better
You can obviously use all of those keywords in strict mode that you showed
in strict, you cant
i think only my compiler is in strict
lemmedouble check rq
yep, compiler in strict
lemme try rq
tf is allowjs
strict is pretty much a must in a tsconfig
also wasn't there an option for no implicit any
or did that get removed
Bruv? @opal plank
use strict 
Didn't you say you can't use those keywords in strict mode
yup it does catch
also even without 'use strict'
i assume the ts config does it forme
I removed the User info text on the top and now this is what i have:
https://cdn.discordapp.com/attachments/750091983191670805/754986533353816094/profile.png
I didn't mean like that
is it lookin' good
then?
then?
@opal plank more like.then(reply?: confusion)
hehe
You obviously can't use global keywords as variables or function names, i meant what does strict mode do to your js code? Throwing more errors? Increasing speed?
idk wtf i said
You obviously can't use global keywords as variables or function names, i meant what does strict mode do to your js code? Throwing more errors? Increasing speed?
@earnest phoenix read the MDN docs link i sent
try writing that same snippet in vanilla js
But yea went there and saw
actually,lemme do it
try writing that same snippet in vanilla js
@opal plank bruh strict mode is also a type of vanilla js

without strict it allows you to
if you get that error your module is in strict mode
this one
@earnest phoenix
I have this ```js
if(message.channel.type !== 'nsfw')
WHY DOES CANVAS DRAW TEXT FROM THE BOTTOM LEFT TO THE TOP RIGHT AND DRAW IMAGES FROM THE TOP LEFT TO THE BOTTOM RIGHT
@fringe axle cuz its channel.nsfw not type
Oh
type returns dm | textchannel | something else
Thanks
@fringe axle stop with these NSFW commands man
D:
more horny bots is what we all need
flood the discord community with horny bots
i need @Tim#2373 and @flazepe#8587
Mine is in NSFW channels only :0
but still
why do you have nsfw anyways
cuz you underestimate the power of horny people
thatprob my third highest used command

gotta understand your demographics, discord is filled to the brim with furries/weebs
lol
is there any better way to get id of voter user without using ksoftapi?
how?
does this work with both bots and server votes?
@royal bane paid hosting services
with free ones you'll have downtime
or you can host it yourself
if you have an old computer that's buggy enough and not used
how can i host for free?
check in google for free hosting
ok
and the bot goes in a sleep mode 30min after last used
how hours are there in one month?
can heroku and i host at the same time?
@royal bane you can use aws which is "technically" free
uh?
or you can try chaoticdestiny hosting or fatcat hosting they give 1 pterodactyl server for free
whats pterodactyl?
ok
basically you can host your bot there no downtime 24/7
can heroku and i host at the same time?
@royal bane you can host at the same time but that will just make your bot send work on commands twice or more every time
so it's not good
no search for "pterodactyl server"
oh ok
ofc if you search just pterodactyl thatll get you the dinosaur
pterodacty.io is it?
thats the website for pterodactyl yes but thats not what you wanna visit
ok
i can dm you the link if ya want
you can get a vps capable of running a bot for like $3 a month
vultr, i think
it might be worth it, rather than relying on free
if only i had a credit card
got paypal?
any VPS which i can buy with cryptocurrency?
got paypal?
@green kestrel under 18
only hackers use cryptocurrency

only kidding
ask permission from parents ez
they won't let me
yeah, $3 is like, below pocket money amounts
i'm untrustable 
yeah, $3 is like, below pocket money amounts
@green kestrel i have 0.10$ a week pocket money because i avoid eating junk food to save up time for programming
i remember the days when i had pocket money
*0.14$ forgot 10 rupees is 14 cents in dollars
now i have to go to work and earn it all, for it to go straight back out on bills
this ain't #development anymore tho
yeah lets move this convo
halp me
hot tf
how
remaking a generator not the bad one but a good one which gens quotes and other stuff
.setColor("FF0000")
.setTitle("TIMINGS")
.setThumbnail("https://cdn.discordapp.com/icons/694838568333475880/a_c2217a7a1bf26f8d5a1927a68de2c814.gif ")
.setDescription(`
**3 MATCHES WILL BE HELD EVERYDAY TILL LESS REGISTERATIONS**
```REGISTERAION FOR 3:00PM STARTS AT 12:00PM```
```REGISTERAION FOR 3:30PM STARTS AT 12:10PM```
```REGISTERAION FOR 4:00PM STARTS AT 12:20PM```
**FOR MORE INFORMATION CONTACT MANAGEMENT & STAY TUNED WITH #𒌇・au-announcements **
`)
message.channel.send(embed)```
SyntaxError: missing ) after argument list
it says syntax error
missing )
You have to escape the backticks inside the string. If you don’t, the parser will terminate the string at the next backtick instead of the end of what you want to be the string
if using js and python on a dashboard
js (dashboard)
py (bot)
what mongo language do i do the driver?
technically if you have a credit card you can get 12 months of free hosting on AWS
and nothing you can rely more on than amazon
what's the ratelimit for editing an embed message?(like I can edit in every x seconds(altough I will stop the loop after few seconds so that it doesn't api abuse))
cuz that’s cached
so what should i do
do bots blow up easily?
no
how
hm
halp me
@indigo burrow wasn't RichEmbed deprecated in v12?
MessageEmbed()
Discord.MessageEmbed()
How can I perform an action for all the channels
How can I perform an action for all the channels
@delicate shore you'd have to do a for loop over each channel in a guild
It's worth getting into the habit of saying "for each" instead of "for all"
yes
try evaluate
k
TypeError: Unexpected type of argument in function evaluate (expected: string or Array or Matrix or number or boolean, actual: undefined, index: 0)
@pale vessel new error
show code
const Discord = require('discord.js');
const math = require('mathjs');
module.exports = class MathCommand extends Command {
constructor(client) {
super(client, {
name: 'math',
aliases: ['solve', 'calc'],
group: 'utility',
memberName: 'math',
description: 'I\'ll do your math homework!',
examples: ['~math [equation]'],
throttling: {
usages: 1,
duration: 5
},
args: [{
key: 'equation',
prompt: 'Please provide me with an equation to solve!',
type: 'string'
}]
});
}
run(message, args) {
var { equation } = args;
try {
var solution = math.evaluate(equation)
} catch (err) {
return message.channel.send(`❎ | I couldn\'t solve that equation! \`${err}\``)
}
const embed = new Discord.MessageEmbed()
.setColor('#767CC1')
.addField('**📥 Expression**', `\`\`\`${equation}\`\`\``)
.addField('**📤 Result**', `\`\`\`${solution}\`\`\``);
return message.channel.send({ embed })
}
}```
how do u guys add channel related thingy ?
like with command handler we can create a single file for a command and its makes our project easy to manage .Index.js looks clean for that .
but some feature which doesn't need to trigger with bot prefix where u guys code them ? in index.js ?
like in my bot i did something like mod-mail , u dm the bot and bot will post that message in a specific channel , u don't need to use any prefix just type the message .
a counter channel where people just count 1 ,2,3 ,bot just monitor that channel if someone miss a number of post anything else thats not a number
i have another channel monitor in a channel like one-word story ,so if someone try to send multiple word bot will delete that message .
now the problem is as those message don't need to startwith bot prefix i coded them in index.js . i wonder if i increase channels my index.js will get messy
any other way i can follow ?
looks like commando
yea
@flint yew try console.log(args) before var solution
same error
check console
change var { equation } = args; to const [equation] = args;
you can't destructure using {} for arrays
@pale vessel can u help me in 1 more
with?
"stack": "TypeError: Cannot read property 'startDate' of undefined
where did that come from?
const moment = require('moment');
const sherlock = require('sherlockjs');
module.exports = class RemindMeCommand extends Command {
constructor(client) {
super(client, {
name: 'remindme',
aliases: ['remind', 'timer', 'alarm'],
group: 'utility',
memberName: 'remindme',
description: 'I\'ll remind you of something!',
details: 'This does not persist across restarts! Please keep it short!',
guildOnly: true,
throttling: {
usages: 2,
duration: 3
},
args: [{
key: 'remind',
label: 'reminder',
prompt: 'what would you like me to remind you about?',
type: 'string',
},
{
key: 'time',
label: 'time',
prompt: 'In how long would you like me to remind you?',
type: 'string',
validate: time => {
const remindTime = sherlock.parse(time);
if (!remindTime.startDate) return `please provide a valid starting time.`;
return true;
},
parse: time => sherlock.parse(time)
}
]
});
}
async run(message, args) {
const { remind, time } = args;
const timer = time.startDate.getTime() - Date.now();
const preRemind = await message.channel.send(`Got it! I will remind you in **${moment().add(timer, 'ms').fromNow(true)}**! \`(${timer}ms)\``);
const remindMessage = await new Promise(resolve => {
setTimeout(() => resolve(message.author.send(`⏰ | ${remind}!`)), timer);
});
return [preRemind, remindMessage];
}
};```
try console.log(args) again
"stack": "TypeError: Cannot read property 'startDate' of undefined
check your console
console.log() is used to log something into the console
it's for debugging purposes
"stack": "TypeError: Cannot read property 'startDate' of undefined
at RemindMeCommand.run (C:\\Users\\K\\YK303bot\\src\\commands\\morefun\\remindme.js:48:28)
at module.exports (C:\\Users\\K\\YK303bot\\src\\events\\message.js:52:24)
at Client.emit (events.js:315:20)
at MessageCreateAction.handle (C:\\Users\\K\\YK303bot\
ode_modules\\discord.js\\src\\client\\actions\\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\\Users\\K\\YK303bot\
ode_modules\\discord.js\\src\\client\\websocket\\handlers\\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\\Users\\K\\YK303bot\
ode_modules\\discord.js\\src\\client\\websocket\\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (C:\\Users\\K\\YK303bot\
ode_modules\\discord.js\\src\\client\\websocket\\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (C:\\Users\\K\\YK303bot\
ode_modules\\discord.js\\src\\client\\websocket\\WebSocketShard.js:301:10)
at WebSocket.onMessage (C:\\Users\\K\\YK303bot\
ode_modules\\ws\\lib\\event-target.js:125:16)
at WebSocket.emit (events.js:315:20)"
}
error
only
where did you put the console.log()? it must be before timer since that's where the error is coming from
async run(message, args) {
console.log(args)
const [ remind, time ] = args;
const timer = time.startDate.getTime() - Date.now();
const preRemind = await message.channel.send(`Got it! I will remind you in **${moment().add(timer, 'ms').fromNow(true)}**! \`(${timer}ms)\``);
const remindMessage = await new Promise(resolve => {
setTimeout(() => resolve(message.author.send(`⏰ | ${remind}!`)), timer);
});
return [preRemind, remindMessage];
like that?
yes
i did that
scroll up in your console
that's odd
wdym
try again
ok
can someone help me with this: https://stackoverflow.com/questions/63870225/handling-user-inputs-in-parallel-using-discord-bot
@pale vessel [ 'i', 'am', 'k' ]
2020-09-14 16:04:38 - error [app.js]: Cannot read property 'getTime' of undefined
it give
what i write in discord
so it's not a valid time
What's a Client Secret?
https://gyazo.com/be57bb0dc93b760fe1a37bc905e9d682
client secret is for oauth
oh
the what to fix
you don't need it if you don't use it
oki
i'm not familiar with commando but you should check the args and validate functions
sorry, can't help more than this
okay
hey so i tried to fix this on my own but i still cant find why, so im trying to make a command where i type ^makecache (insert pinged user here) and then it will make a role and add it to that user and will make a MessageEmbed() at the end to say its done
client.on('message', msg => {
if(msg.author.id === '388931035607597057')
{
if(msg.content.startsWith(`${prefix}makecache`))
{
const cacheRole = msg.guild.roles.create({
data: {
name: 'CacheRole',
color: '#ff0000',
},
reason: "ROLE CREATED TO ACCES CACHE CHANNEL"
})
.catch(console.error)
const member = msg.mentions.members.first()
if(!member.roles.cache.get(cacheRole))
{
member.roles.add(cacheRole)
}
const embedSuccess = new MessageEmbed()
//Set the title of the Embed
.setTitle("Cache created!")
//Set the color of the Embed
.setColor(ff0000)
//Set the description of the Embed
.setDescription(`Sunglasses successfully made a meme cache for ${member.user.username}`)
msg.channel.send(embedSuccess)
}
}
else{
}
}) ```
and im getting this error
TypeError: Cannot read property 'roles' of undefined
at Client.client.on.msg (/home/pi/Desktop/shit/Bot/Discord/CustomChannelMakerBot/index.js:27:20)
at Client.emit (events.js:189:13)
at MessageCreateAction.handle (/home/pi/Desktop/shit/Bot/Discord/CustomChannelMakerBot/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (/home/pi/Desktop/shit/Bot/Discord/CustomChannelMakerBot/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/home/pi/Desktop/shit/Bot/Discord/CustomChannelMakerBot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
at WebSocketShard.onPacket (/home/pi/Desktop/shit/Bot/Discord/CustomChannelMakerBot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage (/home/pi/Desktop/shit/Bot/Discord/CustomChannelMakerBot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
at WebSocket.onMessage (/home/pi/Desktop/shit/Bot/Discord/CustomChannelMakerBot/node_modules/ws/lib/event-target.js:125:16)
at WebSocket.emit (events.js:189:13)
at Receiver.receiverOnMessage (/home/pi/Desktop/shit/Bot/Discord/CustomChannelMakerBot/node_modules/ws/lib/websocket.js:797:20)```
its gonna make a role everytime because i need it to since im also going to make a channel soon for that specific role but right now trying to get my embed and new role to show up

wdym, i defined it there
you mentioned a member right?
yes
where is line 27?
i am still not sure how do it.
@eternal osprey wdym
line 27 is the if(!member.roles.cache.get(cacheRole)) if statement
so there is no member mentioned, according to the error
anyone know commando
why would that be, i wouldnt be able to move it outside of the event
good gun
msg.mentions.members is a collection of mentioned members in the message and .first() grabs the first member. if undefined, it means that there's not a single mentioned member
after const member, try adding if (!member) return msg.channel.send("no member")
wait im trying to say the mentioned member on my command is that a problem
guess what
now its saying "MessageEmbed()" isnt defined
const embedSuccess = new MessageEmbed()
//Set the title of the Embed
.setTitle("Cache created!")
//Set the color of the Embed
.setColor(ff0000)
//Set the description of the Embed
.setDescription(`Sunglasses successfully made a meme cache for ${member.user.username}`)
msg.channel.send(embedSuccess)``` it is here
that's using it
is it
what did you define require("discord.js") as?
try Discord.MessageEmbed()
ok so, it cleared the error, but i pinged a user and it stil said "No member specified"
its clearly my member variable that fucking stuff up
can you add console.log(msg.mentions) before defining the member?
check your console after that
ok
this is what it logged
MessageMentions {
everyone: false,
users: Collection [Map] {},
roles: Collection [Map] {},
_members: null,
_channels: null,
crosspostedChannels: Collection [Map] {} }```
sunglassesToday at 11:21 PM
^makecache @test scripts
Meme Cache Maker
BOT
Today at 11:21 PM
No member specified```
can you show a screenshot?
im runningon pi and dont have screen shot program
ill clean it up
sunglasses: ^makecache (pinged user)
Meme Cache Maker: No member specified
did the mention show up as @ flazepe or @pale vessel ?
so @pale vessel
yes
should i remove the if statement that checks what user is sending the message
the if(message.author.id == "id")
The if would only execute the code block if it was true.
So, if that's the expected behavior.
its getting past ther so thers no point of removing it
Also, I recommend not hard coding your ID, and instead keep a config file with it inside
how do i debug c# files?
@eternal osprey What are you writing your code in?
vsc
So for VSC you need a launch.json and a tasks.json inside the .vscode/ folder in your project directory
For example, the top 2
okay
i tried to run the little snippet you sent me
so i could see how i operates
idk if you mind?
So you can execute it correct?
Make sure you click this
i supposse .netcore
yeah
I seriously need an actual command handler instead of an ENORMOUS block of switch case statements
but i won't be able to do aliases so 
Exactly what it says
program framework and project name
how de fuck do i find bin
no?
i don't have that lmao
should i die 
dotnet is not a command
i aid
do you have dotnet sdk installed? lol
said, that i wanted to look how your program operates.
right
You need dotnet sdk to compile and run your C# code
with that, you can tell VSC how to debug it
and then you can set breakpoints and stuff
also that code snippet should be easier to rewrite in Javascript
So, why aren't you just doing that?
Free downloads for building and running .NET apps on Linux, macOS, and Windows. Runtimes, SDKs, and developer packs for .NET Framework, .NET Core, and ASP.NET.
yep
i will write it in j
it is my best language
i just want to see how it operates.
i have downloaded the left one already
i will write it in j (js?)
That's a good idea
it is my best language
You're allowed to have that opinion, but i disagree
i meant js, my keyboard just struggles.
and i don't mean that it is the best language out there
i mean that i know the language the best
Ah gotcha
from all the other ones i know
That's how I am with C#
But what I want you to understand is that the concept is the same
I seriously need an actual command handler instead of an ENORMOUS block of switch case statements
but i won't be able to do aliases so :CS_AlphabetF:
@earnest phoenix just check the djs guide
it has aliases
wtf
it does proper cooldowns, aliases, cmd handling

programming a simp bot 😈 💯
lol,a few too many buttons on here perhaps?
i dont know whats going on
^
its the admin backend for my bot, for moderators who maintain the bots database
they kind of know what theyre doing with it, but its still becoming a mess
yea
but i think it'll look better if you change the colors
the blue pops too much imo
blue in some spots is ok but not for all buttons
can i delete everything if i were to be able to access the moderator panel
one question at a time? 🙂
for me to then revoke that access and restore a backup? 😛
i think someone might notice youre doing it
plus, the ids are not sequential, theres huge holes in the sequence
Jake never eats cake
how do i translate this to another language
without using any npm package in discord.js
what if your mods scrape the webpage and do their job remotely (eg. from discord bot)? 🤔
@thick gull
yes
yes
Which compiler or lang is this?
it's javascript
java script is literally like scripting java
or sounds like it
JS is drunk Java
^^, literally doesn't even care about types
Jake never eats cake
how do i translate this to another language
without using any npm package in discord.js
Would never recommend to programming beginners at least. Even PascalABC is reasonably better.
it's not retarded, it's just a drunk language.
It's not beginner-friendly is what I would like to imply
and yes it's also drunk
I like js 😆
@small zenith you'll need to design the whole thing yourself if you're not gonna use any npm package or API
ok @earnest phoenix
Python is more consistent and reasonable with its typing at least
if your forced to learn a language it sucks
@thick gull Latin, Hindi, Bengali, QBasic, Windows Batch, XML, even more my school teaches us all kinds of OUTDATED stuff
Yall chatting?
what
are you trying to tell me hindi is outdated

i'm forced to learn python in school, but i don't still hate it or smth
Dev chatting is allowed
i learn no programming language in school 
Windows Batch is outdated?
java script is literally like scripting java
@restive furnace They are too different to compare really.
js was renamed from MochaScript to JavaScript because at the time Java was really popular
imagine forgotteing that hindi ain't a programming language
Windows Batch is outdated?
@slender thistle they tell us windows XP batch we use windows 10except me
imagine forgotteing that hindi ain't a programming language
@earnest phoenix
is it?
hindi da programming language 😈 💯
yeaa
yeah im talking about java script
^ ^ ^
and not javascript
Leo.Muh.melo()
Are Java scripts even a thing?
Are Java scripts even a thing?
@slender thistle yeahshit.js
"script"
java
Script would imply it's interpreted
i'm retarded
yeah
java script != thing // except in java i guess
javascript == thing
Not exactly sure what it could be, but let's say an interpreter with dynamic typing for Java projects
Not exactly sure what it could be, but let's say an interpreter with dynamic typing for Java projects
@slender thistle Why would you want that
Let's just blame being desperate for entertainment during a quarantine...
Java is trying it's hardest to be fast, but already failing. Making it interpreted would make that problem even worse.
oops #memes-and-media
Java is trying it's hardest to be fast, but already failing. Making it interpreted would make that problem even worse.
@faint prism Performance can go out of the window. I'm somewhat confident you know I use Python. 😂
(both ran in JVM, aka intepreted and compiled)
ecmascript is a fucking standard language wtf
@faint prism Performance can go out of the window. I'm somewhat confident you know I use Python. 😂
@slender thistle Let me tell you about performance. Once upon a time, I wrote a statistics program in bash. BASH. It doesn't even do complex math natively! I had to pipe math functions to a calculation library (bc). Which added an insane latency
🤣 I think you went over that at least once before
Couple that with a for loop, and bam. A simple standard deviation calculation takes all night
🤣 I think you went over that at least once before
@slender thistle Glad you remembered 😉
How else am I supposed to use Android's Linux-based OS to host my discord bot? 
you can convert it im pretty sure
Bismillah
not #development
pretty funny, but wrong channel for that
Oh no. Rules existing. :(
Imagine following rules where the anarchy smh
How else am I supposed to use Android's Linux-based OS to host my discord bot?
@faint prism can u elaborate...
Oh geez
Download Termux app. Run apt install node-js. Run node run index.js 
To "host my discord bot"??
Yeah sure why not ||, other than the terrible latency and large use of data||
For example
Imagine thinking ik everything and then meeting some who has more knowledge then you.... :(
that's how this channel goes
Imagine thinking you know everything
That's ignorance, my friend
Someone will always know more 🙂
uptime 24/7?
When was the last time you turned off your phone?
Sure, your bot would go down if you ever lost cell.
But what about having a spare phone running it on wifi?
Shit... that's not a bad idea
That'll have a backup battery...
Cell backup...
And even a better cpu and ram than a rasp pi...
Hmmm... I am a school teen and y'all are professional programmers... It can be seen that y'all r always Have ultimate knowledgelol but I am learning....
no we're all broke college/highschool students
^ this lmao
like shiv
let me spread misery
This server is very diverse, but the main part is just students doing development as a hobby
Yupp
I tbh just wanted to apply some new C# design patterns I learned at work, and thought Machine Learning was cool. And somehow ended up making a bot with both of those. And consequentially learned how to use a non-relational database.

i dont think it was lol
it was
Javascript (originally Mocha) is nothing like Java
i lost brain cells i should leave this server
That's more of an interop
how do i differentiate msgArgs elements like for example, zira bot does to edit messages?
wdym
split by space, get X index
like
https://canary.discordapp.com/channels/264445053596991498/272764566411149314/755078230276440164 .split(" ") or let me get the better ver
.split(/ +/g)
^
hi, you advise me what as a method to perform a clear user "<prefix> clear @user <number>"
That's just attaching JS -> Java. Kinda like how I'm using interpreted C# in my bot's eval using CSharpScript library (Dotnet Roslyn API)
.split(/ +/g)
@shy turret is that not the same thing
regex + is just 1 or more
ikr
why is it "better"? because it's regex lol?
.split(/ +/g) should be good if you !command <args> <a lot of spaces>
it is better in some cases
ah. Good point
I see the use now
wouldn't be fun to parse an array of strings that's like [8] or something because someone put a ton of spaces
i wouldnt use it if you do -send this message
LOL
What not to do:
message.channel.send(`${args[0] ? args[0] : ""}${args[1] ? args[0] : ""}${args[2] ? args[2] : ""}${args[3] ? args[3] : ""}${args[4] ? args[4] : ""}${args[5] ? args[5] : ""}${args[6] ? args[6] : ""}${args[7] ? args[7] : ""}${args[8] ? args[8] : ""}${args[9] ? args[9] : ""}`);
is here someone that can guide me on webhooks
why not? you'd just check if the arr[i] is a command, if it is, the argument would be arr[i+1] and any arr[] after it until another command is found
@earnest phoenix what lib or using fetch()
discordpy
I'd just loop over the array of strings, and construct the command args until I hit another command
which webhooks
dbl vote
To quote my message from #topgg-api,
It's literally a webserver listening to POST requests
If you need async webserver, use Sanic or aiohttp.web
if you don't care about async, feel free to use Flask or overcomplicate life with Django
im kinda confused how message events work on libs
does the bot just spam GET requests
to discord
No, Discord sends websocket requests to you
wait what nani
A Discord bot receives messages and other real-time events over websockets
so we get reqs?
Yes, events like message receiving, role updates, etc.
.split(/ +/g)
@shy turret
and how do i diff the first part and the second part of the msg?
@shy turret
and how do i diff the first part and the second part of the msg?
@dreamy thistle Pretty sure I explained that
https://discordapp.com/channels/264445053596991498/272764566411149314/755080111040102581
oh, my bad
im gonna delete my dashboard and start again
can anyone advise me the best way to do it
~~use wix
[/s just in case, shiv]~~
for reference i mean a dashboard as in somewhere you edit your servers bot settings. (login with Oauth)
const Clowns = new Set()
if(command == 'clown') {
let newClown = message.mentions.users.first()
if(Clowns.has(newClown)) {
Clowns.delete(newClown.id)
message.channel.send('removed clown')
}
else {
Clowns.add(newClown.id)
message.channel.send('new clown!')
}
client.on('message', function(message) {
if(Clowns.has(message.author.id)) {
message.react('🤡')
}})
``` this code does everything right, except it doesn't remove the user ID from the clowns constant. I'm confused as to why this doesn't work. Can anyone help?
that looks like you're using multiple messages events
const Clowns = new Set()
Not sure if that's valid (I don't do JS), but it'll reset the Clowns to empty every time
Is that code block in a function or...?
Oh
wait didn't i help you last time
It's in my entire async function
and you did the same thing
lol
I just moved it cus I was just trying things
it didn't work while it was in the if statement either
I'll put it outside of my function and see if it works
It still doesn't work
this code used to work but I had to change it because I was stupid and used listeners for every command ```javascript
const clowns = new Set() //w!clown command
clowns.add("313481150637277197")
clowns.add("224363077318082561")
client.on('message', function(message) {
if(message.content.startsWith(${prefix}clown)) {
if(!message.member.hasPermission('ADMINISTRATOR')) return message.reply('cant use this L')
if(message.mentions.everyone || message.mentions.roles.size) {return message.reply('Improper mention.')}
let person = message.mentions.users.first()
if(person.bot) {return message.reply('You cannot clown bots.')}
let newClown = message.mentions.users.first()
if(!newClown) return message.reply('You need to mention the user you want to clown.')
if(clowns.has(newClown.id)) {
clowns.delete(newClown.id)
message.reply('removed clown :(')
} else {
clowns.add(newClown.id)
message.reply('new clown in town!')
}
}
})
client.on('message', function(message) {
if(clowns.has(message.author.id)) {
message.react('🤡')
}
})
you're still using two message listeners
lol
No I'm not using that anymore
why not move the second one inside the first one too
That's old code that was basically just a test
I don't use that anymore
I'm just saying that used to work and I have essentially the same thing now and it doesn't work in my new code
hey how do i delete a message in a certain amount of time (15 s)
rip my messages 😔
message.author.send("<@" + message.author.id + ">")
return message.author.send(embed);
```
gone but never forbotten
await the message or use then. you'll receive the sent message. delete it using <message>.delete() with the timeout option (<mesaage>.delete({ timeout: 5000 })). timeout must be in milliseconds
you can also use ms
if you wanna do like
args in a command
and not just in milliseconds
i mean ms as in the module
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: filter must be an instance of dict, bson.son.SON, or any other type that inherits from collections.Mapping``` code ```levelstoggled = collection.find(guild_id)```
With mongo, you need to specify which keys of a collection must be found
you are simply saying "find me a document with guild_id" without specifying which key it is
as in {"key": "value"}
you know how in mongodb there's `{-
because mongo is JSON
BSON for all I care
Can anyone here give me advice regarding an issue i have with my npm package im making?
you still work with a dictionary if you pull up a document
Anyone got experience with making npm packages?
@pale vessel i did what you said
UnhandledPromiseRejectionWarning: TypeError: message.reply(...) is not a function
So my package that I'm making is to get data from my mysql database on my website. Like getting an id of a user then it shows other details about them etc. How would I get it to connect to the MySQL database because if I just insert my MySQL details such as host,user,password etc people can just go in the node_modules file and get info and then login and that would not be ideal at all.
````message.reply("A private message has been sent to you!")(message.delete({ timeout: 15000 }))```
Would I have to make an api that the npm package gets info from?
use reply().then(sentMessage => <delete>)
how to delete a message with the message id?
How can you ping a website and get the ping in HTML?
Sorry what
Like I want to ping google.
<h1>Ping: Example MS</h1>
html is markup
I know but anything with <script>?
use javascript or get a backend
what's arg
so basicly if the word true is in arg
use javascript or get a backend
@pale vessel any other idea?
do you want it to be strictly true or anything like I'mAButterflyIFlyLikeAtrueFly
@slender thistle i mean if its strictly true
I want to ping
www.google.com
and then it should return the ping in a HTML Line
if its not too hard
use Date.now() and fetch/xhr i guess
Me?
yes
oof
(node:13748) UnhandledPromiseRejectionWarning: ReferenceError: sentMessage is not defined
@pale vessel
sentMessage = await message.author.send()
can't i just use mesasge.delete?
and what are you deleting?
that deletes the OG message
message.author.send("<@" + message.author.id + ">")
message.author.send({embed});```
still not defined
ffs i dont get this
you can't reply()(sentMessage.delete())
put sentMessage.delete() in a new line, without parenthesis
uhhm so
@slender thistle i mean if its strictly true
@drifting wedge u there?
TypeError: Cannot read property 'split' of undefined anyone can help
message.reply("A private message has been sent to you!")
sentMessage.delete({ timeout: 15000 })```
lib?
like this @pale vessel
yes
TypeError: Cannot read property 'split' of undefined
The person you have attempted to reach is not available due to lacking braincells at this moment. Please try again when they are done having a tantrum.
should i ask again
yes
I'm trying to make a new web dashboard for my discord bot (in nodejs). Could anyone advise me the best way to do it or walk me through some of the basics? For reference i mean a dashboard as in somewhere you edit your servers bot settings. (login with Oauth, etc.) I do have a mogodb and stuff that the bot runs off but im happy to change if someone can suggest something better for this application
🤞
the property you're trying to split is undefined, exactly what the error said
lol
i mean how to fix
show code 🤡
I'm trying to make a new web dashboard for my discord bot (in nodejs). Could anyone advise me the best way to do it or walk me through some of the basics? For reference i mean a dashboard as in somewhere you edit your servers bot settings. (login with Oauth, etc.) I do have a mogodb and stuff that the bot runs off but im happy to change if someone can suggest something better for this application
@charred geyser Mongo is fine as a database. I'm not a JS dev but you could probably use something like express server for backend
Use node-fetch for OAuth
@pure lion can u tell him the basics of oauth
discord will temp-ban your bot for an hour if it gets 10,000 invalid requests in 10 minutes from your bot. this includes the "spam" error, 429. right?
doesnt discord.js automatically throttle the client before it begins reaching the 429 error? how come my bot is still getting temp-banned despite having < 100 api errors across 4 days (most of which are "cannot dm user" errors which are unavoidable)
unavoidable? Yes they are, just send everything in a channel
i only send one dm when users vote - its definitely not spamming the api with failed dm requests
message.reply or message.channel.send() for that
@pale vessel errior
(node:11828) UnhandledPromiseRejectionWarning: TypeError [INVALID_TYPE]: Supplied options is not an object.
sentMessage = await message.channel.send("<@" + message.author.id + ">" , "A private message has been sent to you!") message.reply("A private message has been sent to you!") sentMessage.delete({ timeout: 15000 })
"stack": "TypeError: message.say is not a function
anyone know how to fix that
anyone know?
message.reply or message.channel.send() for that
dont work
2020-09-14 18:58:24 - error [app.js]: Cannot send an empty message
{
"name": "DiscordAPIError",
"method": "post",
"path": "/channels/739485293547356171/messages",
"code": 50006,
"httpStatus": 400,
"stack": "DiscordAPIError: Cannot send an empty message
at RequestHandler.execute (C:\Users\K\YK303bot
ode_modules\discord.js\src\rest\RequestHandler.js:170:25)
at processTicksAndRejections (internal/process/task_queues.js:97:5)"
:/
message.channel.send()
Cannot send an empty message
what are you trying to send lmfao
gif
do you have the link?
my bot must send giphy
It needs to be an attachment
fetch(https://api.tenor.com/v1/random?key=${tenorAPI}&q=${text}&limit=1)
no
how do you not know how to message.channel.send
thats like
the first thing you learn
You’re sending an empty message
no
all working
are you trying to tell me you have a command handler
but
you dont know how to message.channel.send
what?
ok no help for you then
already fixed
🤡
yea sure
aye
its okay but i wanna make it better
my ideas are:
website (dashboard, really wanna do but struggling)
xp system, probably could do but not priority
adding support for searching places like youtube
giving the bot music functionality
do you think if i have these all working they will accept my bot?
nah
oauth is not too hard
i just
im not sure how to make a website that gets user info like guilds where they have perms and put that into a nice looking ui
you know like
you log in with oAuth and you get a list of your servers
and then you can edit the settings
i wanna do that but i assume that means it has to be a node app becuase idk how tf else to get discord info
Just like the normal dashboard used by other bots... Right?
precisely
Like first getting a list of server on which u have admin perm and can change the settings...
yes
😮
i haven't worked with guild displays, i'll set up a test application and i'll brb
ok yea i just cannot figure this out

ok yea i just cannot figure this out
@misty sigil rip
do you know anyone who might?
no idea.
Hello
Do you need help or not owo
yes
Once you do it once you got it forever
from there
Easy
Do you want to load it into a cookie?









