#development
1 messages Β· Page 426 of 1
lavalink
lavaplayer
ew
lavaplayer is only for java u weeb
Yeah
but lavaplayer is really nice
lol
π
using a module just to search seems unneeded
(discord.js) guys if I made a command like this would it work? ```if (command === "checkid" {
const idsent = get.args.first
if (idsent !== user.id) {
message.channel.send("But that is not an ID lol");}
else {
message.channel.send(That ID belongs to **${idsent.user.tag}**.);}
}```
no
lavalink is the best
this botto will be using my custom framework instead of someone elses π https://wolfiri.took-my-blobs-away-from.me/axvrng.png
Hey I'm new to bot development and I keep encountering this error Error: cannot find module 'npm' I didn't change anything files I just changed the bot status from offline to online
Everything is installed because it was running fine
@spring ember who said i was starting my own lib
I'm using my own framework, it's under discordia but a custom modular system
@tall falcon it is as simple as that you should download npm
@worn sparrow oh ok so it extends discordia
Npm is installed
is it global?
Yes
wait do you require it?
is it in your PATH
I'll install it again
if it's global then it is in the path usually
Oh okay
go to your start menu search PATH
if it's windows
ew hosting on mac os
I'm using win10
good
so do as @worn sparrow said
search path
I'll be migrating to Linux soon though
if it wouldnt exists it would say command not found or something but what is cannot find module
then ya double click PATH
Ok
%appdata%\npm might also work
Works thanks
π
How do I check if the ID of the person who sent the message is the same as the one in the variable, for example? discord.js
this way it's not working:
if (message.author.id == 260227813037047820){
//code
}
javascript can't represent snowflakes as ints, they have to be strings
BigInt 
BigInt is already in Chrome 67
comes to node.js soonβ’
in 10 or 11?
interesting
idk what you can really do with BigInts I cant find documentation
thats kinda annoying
lol
So I was going though some of my nsfw commands to make sure they work because I made them today to make sure they work and I get this error after running one command 2 times https://hastebin.com/fumukohede.sql What does it mean?
your function seems to be calling itself repeatedly or other functions
@buoyant estuary if (message.author.id === variableId or '1234567890') { //...
why not? ofc it will
are you memeing alex
no?
it'll always evaluate to true
Β―_(γ)_/Β―
well
also message.author.id === variableId or '1234567890' isn't even valid js
yeah
i put that so they choose what they have
I just checked with my syntaxer
.>
so it'd be message.author.id === variableId or message.author.id === '1234567890'
yes alex, that but with ||
ok
Is anyone working on a chat bot with deep learning capabilities?
deep learning sounded spoopy to me π
You making an AI?
is anybody else using discord bot maker on steam?
@uncut slate this works.. thx!
is there a native js way to repeat some code x times? like i want to run the skip() function x times, where x is defined as the length of the queue
for loops ```js
for (let owo; owo < 5; owo++) {
// do something here
}
for(let i = 0; i < x; i++) code()
umm.. idk i'll just use llamas since it makes sense but thanks
both examples are the same thing
it's literally the same thing?
π
just different variable names
oh
so i added it. will the code i pointed to with the arrow run AFTER all the songs have been skipped?
thats what i'm aiming for
yes
okay thx
you could just do queue[msg.guild.id].songs = []
true 
ok so when i run !skip or a song ends it skips, but on the second time nothing happens. is that because the dispatcher.on(end) event isn't there anymore?

play cmd and the event is @ https://hastebin.com/yiziyuwaxo.coffeescript
@mental solstice planning to yeah
fixed my last issue. but @inner jewel @trim plinth that code you gave me, the dispatcher.end is running before all songs are removed, or its just not working at all
since !stop is acting like !skip >.>
oof
# dblstats command
@bot.command(pass_context=True)
async def dblstats(self, *, botid):
"""Get bot details on a bot from Discord Bot List."""
stats = requests.get("https://discordbots.org/api/bots/" + str(botid)) # parse the json api with the bot id
stats = stats.json()
stats = stats[0]
embed = discord.Embed(title="Discord Bot List.", description="Stats for the bot.", color=0x176cd5)
embed.add_field(name="Bot name", value=stats['username'], inline=True)
embed.add_field(name="Upvotes", value=stats['points'], inline=True)
embed.add_field(name="Description", value=stats['longdesc'], inline=True)
embed.add_field(name="Tags", value=stats['tags'], inline=True)
embed.add_field(name="Library", value=stats['lib'], inline=True)
embed.add_field(name="Prefix", value=stats['prefix'], inline=True)
embed.set_thumbnail(url=stats['defAvatar'])
await bot.say(embed=embed)```
Similar to how I'm parsing the Steam API but I don't get a terminal error or a printed error.
It registered that the command was being ran but didn't parse the API correctly.
requests 
@gilded thunder use the aiohttp module
is it easy to convert over to?
That's for rewrite.
you don't have to use it though
I'm using async
but I also don't think it's just for rewrite
It doesn't matter what version of discord.py you use, it works just the same, if you know what you're doing.
Collecting aiohttp>=2.3.9 (from -r requirements.txt (line 1))
Could not find a version that satisfies the requirement aiohttp>=2.3.9 (from -r requirements.txt (line 1)) (from versions: 0.1, 0.2, 0.3, 0.4, 0.4.1, 0.4.2, 0.4.3, 0.4.4, 0.5.0, 0.6.0, 0.6.1, 0.6.2, 0.6.3, 0.6.4, 0.6.5, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.8.0, 0.8.1, 0.8.2, 0.8.3, 0.8.4, 0.9.0, 0.9.1, 0.9.2, 0.9.3, 0.10.0, 0.10.1, 0.10.2, 0.11.0, 0.12.0, 0.13.0, 0.13.1, 0.14.0, 0.14.1, 0.14.2, 0.14.3, 0.14.4, 0.15.0, 0.15.1, 0.15.2, 0.15.3, 0.16.0, 0.16.1, 0.16.2, 0.16.3, 0.16.4, 0.16.5, 0.16.6, 0.17.0, 0.17.1, 0.17.2, 0.17.3, 0.17.4, 0.18.0, 0.18.1, 0.18.2, 0.18.3, 0.18.4, 0.19.0, 0.20.0, 0.20.1, 0.20.2, 0.21.0, 0.21.1, 0.21.2, 0.21.4, 0.21.5, 0.21.6, 0.22.0a0, 0.22.0b0, 0.22.0b1, 0.22.0b2, 0.22.0b3, 0.22.0b4, 0.22.0b5, 0.22.0b6, 0.22.0, 0.22.1, 0.22.2, 0.22.3, 0.22.4, 0.22.5, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.5, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5, 1.1.6, 1.2.0, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 2.0.0rc1, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6.post1, 2.0.7, 2.1.0, 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.2.4, 2.2.5, 2.3.0a4, 2.3.0, 2.3.1, 2.3.2b2)
No matching distribution found for aiohttp>=2.3.9 (from -r requirements.txt (line 1))
root@joshek:~/DBL-Python-Library# clear```
pip didn't find anything and manual failed to find a version.
π€
Collecting dblpy
Could not find a version that satisfies the requirement dblpy (from versions: )
No matching distribution found for dblpy
root@joshek:~# ```
That worked.
(Also, are you logged in as root?)
You shouldn't ever run stuff as root, unless required to
I share the VPS with someone else, I keep the bot in my root folder so he can't snoop around.
There are better ways to do that. Do you have a sudoer's file?
Probably.
Also your home folder should be locked anyways (if you have one for your normal account which I assume you do)
Did you set up the VPS?
Yeah, I'm hosting it on DigitalOcean.
And you have a regular user account right? If not, no big deal
Yep, got one.
Sign in as that and see if you can use sudo
So on that account type in sudo pip3 install dblpy
I have dblpy installed.
It shouldn't install it since you already installed it
I did pip3 install.
It's just a test command
Ohh, gotcha
You do something like sudo ls /root
If you can do that that means you can run stuff as root
is a ping like this (-123ms) normal or is there something wrong with my bot..?
Yep, sudo ls /root asked for the password and displayed it.
It will ask for that user's password in order to do stuff. Using sudo is much better than being logged in as root because it restricts access to your account in case anything malicious came across it
Good
So just tag sudo in front of a command that requires root
So I just run the bot under that account then?
You can sudo <then your run command>
It will run it as root, but you never have to sign into root
I know how it works.
As for hiding your stuff, you should already be set on that
Dual-boot with Ubuntu and Windows 10 π
But your profile is Kali 
That's for Pentesting
ik
^
I don't use it as a main home environment. I prefer to stick with things better suited for it
I love Kali though
Yeah, but it does have one unlike most distros
Yeah.
Anyways, GL with the bot
Thanks
@dapper moon What math are you doing?
@mild garnet
module.exports = {
help: {
name: 'ping',
description: 'Pong!',
usage: ''
},
config: {
aliases: [],
guildOnly: false,
ownerOnly: false,
},
execute: async (msg, args) => {
const m = await msg.channel.send('Ping?');
m.edit(`Pong! :ping_pong: ( **${~~client.ping}ms** API heartbeat, **${msg.createdTimestamp - m.createdTimestamp}ms** roundtrip/response )`);
},
};
thats the cmd
m.createdTimestamp - msg.createdTimestamp?
(Date.now() - m.createdTimestamp)
why a new date
i do it in my ping command
msg works fine
ok 
@mild garnet swapping them around worked ty! :p
Isn't math something
math annoys me
Np dude. Glad it worked
i dont think thats technically true
math raised me as a young child
I am 100% right
technically without math computers wouldn't exist
so technically we wouldnt be here (Discord) without it @mental solstice
well you didnt specify "here" earlier, and according to Mrs. Daniels, my 7th grade Health Teacher. Conception has nothing to do with math.. Thank you for clearing that up.
@earnest phoenix
ye I figured you misunderstood
No, i understood clearly. Just easy to twist things when people use vague words.
I got a C- in that class however π¦
Please use #memes-and-media to discuss why math is the reason for human existence. This room is for development.
hey
wrong chat
yeah, you should have told him that like 10 hours later
it was 3 hours
Soo any idea if there is a way to make the bot realize you voted faster?
dbl.hasVoted(message.author.id).then(voted => {
if(!voted){
@ me pls
how slow is it
use webhooks
Check DBL's api documentation > Webhooks
It shouldn't take any time. From what I tested after someone presses vote the api will have the new value
hmm
lol
so that wont work π
no
No
this is a webserver

Not a discord webhook.
how to use that
r i p
If youre using JS.. Tonkku pinned a webhook listener example in #topgg-api
Might need to setup portforwarding, and make a firewall rule for the same port
Easy to set up php webhook listener that will forward to discord too. Another way to get user ids
How do I make a bot message the server that it updated without being prompted?
also uh python
Nonono
I meant like for example i'm a bot
New commands have now been added to the bot!
like it will send a message automatically
without using a command
So you are going to spam all the servers it is in?
Yes
Or just the bot server?
Well idk if people used my bot
People would probably get annoyed by that if you spam them with updates
But anyways, you can still do that
Well I rarely update the bot so i'm fine
plus i'll only announce the important stuff
You have to pick 1 channel in each server to send to
oki oki
and then
Run it on ready or connect?
run it on ready
Anyways for sending a message on ready or connect you do ```python
async def on_ready():
for guild in client.guilds:
for channel in guild.channels:
# Find some way to figure out which channel you are going to spam
# Like saying if "bot" in channel.name: #Do stuff
It's been a while since I've looked at the API though. These might be slightly off
I'd recommend getting familiar reading the API docs
That will grab all of the channels in all guilds
If your variable for the bot isn't named client, it's probably named bot
What?
I have a function for getting the main channel
^
Do something like that
If I said anything wrong feel free to correct me. I gtg do other stuff
channels = guild.text_channels
text_cha = [x.name.lower() for x in channels]
lines = ["general", "lounge", "chat", "hangout"]
words_in_line = []
for y in lines:
words_in_line += [x for x in text_cha if y in x]
k = []
if len(words_in_line) > 0:
for x in words_in_line:
channel = discord.utils.get(channels, name=x)
perm = guild.me.permissions_in(channel)
if channel is not None and all([perm.send_messages, perm.read_messages, perm.embed_links]):
k.append(channel)
channels.remove(channel)
if len(k) == 0:
for x in guild.text_channels:
perm = guild.me.permissions_in(x)
if all([perm.send_messages, perm.read_messages, perm.embed_links]):
k.append(x)
if len(k) == 0:
return None
else:
return k[0]```
Still though, spamming the api for each server is against tos. There is better methods for this. @earnest phoenix
i was told its against the rules to do mass messages like that. Unless you give an option to opt-in
Is anybody working on a Discord using Lua?
How do I make it so my bot (djs) has per server configs?
I have a database setup already in case that's needed
Actually two, Mongo and MySQL
I want the server owners to be able to like change the bot prefix for their servers
If I store that in a variable I know it will reset when my bot restarts
That's not what I want
you could.. Make a table named Configs. insert ServerID, Prefix, etc...
in your command handler, query your DB for the prefix WHERE ServerID = serveridofcommand
if they are configs though.. you could just store in json or something simpler
Per server config shouldn't be on JSON
Use a database
It doesn't matter mongo or sql
I prefer mongo because of Compass
I just use the shell or the Node driver to interact with Mongo
I use the command line for mysql too
I'm afraid querying the db on every command might get a bit slow tho
Specially if the bot is on many servers
I need a bit of help with creating a bot. I've created it and I can't add it to my server
Go to OAUTH2
Copy that link into your browser and select the server you want to add it to @earnest phoenix
Thank you! @ivory hawk
If you plan on sharing it with other servers make sure to add a command for inviting the bot
OK. I wasn't planning on that, I'm trying to learn how to code bots
Oh lol
You should learn how to code first
It's better to learn it first then learn how to make bots and whatever you want to build
If you jump straight onto creating bots without learning how to code it'll likely be hard for you
Even so, if you don't understand what you're typing it's going to be hard to code a bot
I already know how to code. I did 3 years of coding when I was in school
Now I'm finishing off my gcses and hopefully going to get an A in cs
Okay, so I might have an easy html question, but I want to show a thumbnail in Discord's website preview, which will be my logo. How does one do this or is that rendered automatically by the favicon?
No, like my actual website
Your website has an iframe of discord and you want your logo inside that?
No, once a link gets posted of my website in Discord, it will show a website preview with the description and title. But I want to show my logo with it as a thumbnail in the preview embed
Umm you need to return an image for a call to /favicon.ico or declare it
I have declared my favicon.ico to show up at the title.
Maybe metadata.. I might as well google it
Yeah ive used that before to change link preview.. for facebook though, it may work the same for discord though
Comment says discord will pick up the opengraph metas.. so hopefully that solves what youre looking for
Thanks I'll dive into it
Are we allowed to put analytics scripts such as google analytics into the detailed description?
Hi, I'm trying to install my packages to install with npm and I'm getting the error js SyntaxError: Unexpected token } in JSON at position 93799
This is for every package by the way
Hi can someone help me
I tried to publish a bot but it came up with Unable to fetch application
The client I'd is wrong in the application
oh π
Get the bot client id
yeah
ok thank u
if(!withdrawed) {
client.sql.prepare("INSERT OR REPLACE INTO withdrawals (id, user, guild, time) VALUES (@id, @user, @guild, @time);").run(message.id, message.author.id, message.guild.id, now);
client.sql.prepare('UPDATE scores SET credits = credits + ? WHERE user = ? AND guild = ?').run(30, message.author.id, message.guild.id);
message.channel.send(`:credit_card: <@${message.author.id}>, you received 30 daily credits!`);
} else {
message.channel.send(':warning: You already got today\'s credits. Check back tomorrow!');
}```
^
RangeError: Too many parameter values were provided
at Object.exports.run (/app/commands/daily.js:14:122)
at module.exports (/app/events/message.js:55:7)```
why
anyone?
I'm not an expert with SQL but it seems like your syntax is incorrect
Something to do with the values you've set in your query
OR doesn't work like that 
You should query if no results were found insert otherwise update
Or use
INSERT ... ON DUPLICATE KEY UPDATE
hmmmmm
const Discord = require("discord.js")
module.exports.run = async (bot, message, args) => {
let r1embed = new Discord.RichEmbed()
.setTitle("Rule 1")
.addField("Being toxic is not allowed", "Beinng annoying or starting flamewars are ***not allowed***")
let r2embed = new Discord.RichEmbed()
.setTitle("Rule 2")
.setField("Swearing", "Is allowed but please do not over do it.")
let r3embed = new Discord.RichEmbed()
let r4embed = new Discord.RichEmbed()
let r5embed = new Discord.RichEmbed()
let r6embed = new Discord.RichEmbed()
message.channel.send(r1embed)
message.channel.send(r2embed)
}
module.exports.help = {
name: "rules"
}
``` why wont this work (this is for my server)
Error?
(node:1232) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: (intermediate value).setTitle(...).setField is not a function
Np
PS C:\Users\corro\Desktop\emily.codes\SwiftBot> node swiftbot.js
C:\Users\corro\Desktop\emily.codes\SwiftBot\swiftbot.js:11
if(message.author.id !== config.ownerID) return;
^
ReferenceError: message is not defined
at Object.<anonymous> (C:\Users\corro\Desktop\emily.codes\SwiftBot\swiftbot.js:11:1)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:744:10)
at startup (internal/bootstrap/node.js:238:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:572:3)
PS C:\Users\corro\Desktop\emily.codes\SwiftBot>
Can someone help? I'm not sure what to do.
You define message?
Lmao
Do you have an on message event?
yea
and it's message and not msg?
Well the code that has an error isn't in that file
So, for people who are familiar with the verification process here (as I'm in the queue and just want to make sure things go smoothly):
When #rules-and-info mentions "join messages," does it mean messages sent when users join, or a message sent when the bot joins?
I have a message like the latter one, which just provides some basic "how to" info on using the bot, as well as a link to the source and where to get help. If this is against the rules, is a simple if (guild.id === "264445053596991498") return; enough to get by, or is this something that has got to go in general?
I can understand if it has to go; it should be easy enough to patch out. I just want to make sure.
On a user join
It should be in general, but that might get by, idk
That's what I currently have in place.
Do you have on user joins?
Though they will probably test your got on other servers though
Does someone not let you install modules in Javascript?
wdym? @bright bone
Uh no?
It will not let me install modules/packages in JavaScript
Not load
The only messages not sent on request by a user are:
- on
GUILD_CREATEwith ajoinedAtin a sufficient range (to eliminate duplicates) https://github.com/BytewaveMLP/Randibooru.js/blob/dd86ff5e5a1dc19c46ca54b2eeb2397134e321c3/src/randibooru.js#L60-L90 - when announcements are pushed through the bot, using a command only I control (and should probably remove, now that I have a server set up for announcements)
Does it not load?
Is there an error given when trying to install nodules?
It stays there and does not load
it could just be taking a while, depending on the number of dependencies you have
npm on windows isn't the fastest thing in the world
Or you have bad internet :p
ok
PS C:\Users\corro\Desktop\emily.codes\SwiftBot> node swiftbot.js
C:\Users\corro\Desktop\emily.codes\SwiftBot\swiftbot.js:18
client.on(eventName, event.bind(null, client));
^
TypeError: event.bind is not a function
at files.forEach.file (C:\Users\corro\Desktop\emily.codes\SwiftBot\swiftbot.js:18:32)
at Array.forEach (<anonymous>)
at fs.readdir (C:\Users\corro\Desktop\emily.codes\SwiftBot\swiftbot.js:15:9)
at FSReqWrap.oncomplete (fs.js:169:20)
PS C:\Users\corro\Desktop\emily.codes\SwiftBot>
whatever object "event" is, it doesnt have the function "bind"
look in the documentation for whatever libary youre using
Wow that looks so weird without MD
hey okay. I have a feeling this is gonna be a bit confusing. But i wanna see if i can get some help with it. So I'm compacting everything down for ease on myself and heres the code i have so far:
const words = ['tester', 'testing']
const byptester = ['testers', 'testering']
const byptyping = ['testings', 'testinger']
arg.forEach(arg => {
words.forEach(words => {
let word = new RegExp (words, 'gi')
if(arg.match(word)) {
let sio = 'byp' + word
sio.forEach(sio => {
let si = new RegExp (sio, 'gi')
if(arg.match(si)) return;
})
}
})
})```
I want to be able to define seperate arrays depending on the word set off... so u see the concept im thinking of, so i do byp + word, and create the string byptesting for example, but i want to use that to access the array variable "byptesting", and that doesn't work as a string. any idea how i could make it so that i can forEach it depending on the word?
Ofc
If I'm picking up what you're putting down:
woa
@slim heart like uh how exactly is it possible to use the created function 'forEach' meant for a collection on a string
Throudin that kinda looks weird im not to sure whats going on and tbh i wanna understand it instead of just spoonfeed myself
It looks like it doesn't work for bot accounts.
Ye
also throudin that might not be quite right something just looks like its missing idk
Dude
Do you even read what I said
You're using the 'forEach' function from the collection class on a string
Ik like i said ik it wouldnt work BECAUSE its a string yes
@slim heart I made an object, and in it are key-value pairs with the key being stuff like byp + the word you want and the value being an array of words.
Like:
key - byptester
value - ['testers', 'testering']
But im trying to figure out HOW to work it based on what the variable is
Then why do it multiple times in a row knowing it doesnt work that way
If you want that
Yeah
ya throudin nvrm that is what i need
It's a little unclear exactly though what you want in your original question. It sounded like you want a way to access a specific array based on a string input.
And please learn to use for()
throudin almost kinda of, but like any way i want like basically if words is "tester" then it would access an array made FOR "tester"
Thats what hes saying
ya ik
You could do it indeed like his and it'd be something like
const arrays = {
firstArray: ['test', 'something'],
secondArray: []...
}
if(arrays['someword']) { //act on it }
Wait hold on throudin how would i actually turn the mylists into the array i wanted into a variable
would it just be let sio = mylists['byp' + words]
iAlusion ur code has like no similarities with throudins...
So, what you're saying is let's say you had something like
{
"myArray1": ["a", "b"],
"myArray2": ["c", "d"]
}
and the user said "a" you want to grab "myArray1"?
Or is it, if the user says "myArray1" you return it with ["a", "b"]?
But like @tepid laurel said, his const arrays is how you define it.
^
But his is stringified however
Which is not necessary in a js file
However a json is
so wait like
testing: ['testers', 'testering'],
tester: ['testers', 'testering']
}
if(arrays[words]) { //act on it }
Do be sure
That words is the exact key
testing !== Testing
A lil fix could be using the strings .toLowerCase() function
yeah i was about to say id need some kinda of regex flag or some other way of making it so its not exact
i only know regex lmao sorry
Bruh
Regex is not the answer to everything aight
Its pretty op
But not always the way to go
What
idk why i had an = lmao
Why make your code longer
have you tried regex
const words = ['tester', 'testing']
let mylists = {}
const arrays = {
testing: ['testers', 'testering'],
tester: ['testers', 'testering']
}
arg.forEach(arg => {
words.forEach(words => {
let word = new RegExp (words, 'gi')
if(arg.match(word)) {
if(arrays[words.toLowerCase]) {
return;
}
console.log("oof")
}
})
})```
so wait like
testing: ['testers', 'testering'],
tester: ['testers', 'testering']
}
const array = Object.keys(arrays)[word.toLowerCase()]
if(!array) return;
//your code for the array;
I thought that would workπ€
it dont work
Define dont work
It's still unclear what your goal is exactly.
okay ill just spell out the whole thing ig
I wonder whats hes gonna do once he gets the array from user input
Bascially i have a swearfilter bot right, and it does this, wait lemme get the current code
You wanna blacklist words per server and your own ones presetπ€¨
If im not wrong by just guessing
Basically i have it so it matches a specific word, but if it matches a bypass (so it doesnt censor everything)
it returns
like here
if(arg.match(/adic/gi)) return;
if(arg.match(/dict/gi)) return;
if(arg.match(/dice/gi)) return;
if(arg.match(/acidic/gi)) return;
if(arg.match(/dicate/gi)) return;
stopped();
console.log(crash)
}```
if the word matches dic, then it will go into it, but if it matches any of the other words defined it wont go
Bruh
Im just tryna compact it down
Sure looks like it
So do you know regex pretty well?
a decent amount
Learn Regex better
yeah then people do .dick.
/someregex/.test(msg.content)
That you dont need all those fucking statements
I dont need to redo everything ive done
Mr Compact
Im working on this
idcccccccc
lmao
Im trying to do that
But in like this way so i can rely on arrays
like
const array = Object.keys(arrays)[words.toLowerCase()]
i did what u said its not working
like its not recognizing anything at all
Some swear regexs:
https://pastebin.com/FxbeND0m (posted on pastebin so to keep this chat clean)
You can detect matches with these instead of not using Regex to its full potential, being incredibly redundant, and trying to think up all possible "safe" words.
const content = msg.content.split(' ');
for(const word of ['somearrayofbadwords']) {
const ok = /yourregexNotthatgreatatit/.test(msg.content);
if(ok) { do something cause ey it got the bad word }
else continue;
}
I thought this might work lel
Might be a lot slower than @glossy mason example
I keep saying im not here to get my current code criticized...
...
@glossy mason lets just call it a day for now
Yes
I think hes all good
Well i figured it out on my own i just got rid of Object.key and made it the kind of way throudin did it arrays[words.toLowerCase()]
So thanks a bit i guess
You realize that wont work
If your key is 'thisIsOk'
And you put in ThisIsOk by calling the command and putting it to lowercase
The key would still not matchπ€¨
Thats why I was thinking like that but mb
I dont get this one tho
The type is an object but the output is an array
Hm
welcome to js
So why didnt uh
Object.keys() returns an array of the keys of the object
O shit lol forgot
Then it becomes an numeric thing
Rather than by keys
So ['someword'] would not work on it
Right riiip
how can you do something like this:
me:
!search bob
bot:
i found 5 matching users, type the number beside their tag to choose:
1: bob#1234
2: bob rocks#1390
3: bOb#3331
4: bobbob!!#4028
5: someone else named bob#0002
(discord.js)
so a user search based on username and/or tag
something like allUsers.filter(u=>u.tag.contains(input))
allUsers being client.users maybe?
client.users
i made a typo ik
so wait like
testing: ['testers', 'testering'],
tester: ['testers', 'testering']
}
let array = Object.keys(arrays).find((word) => {key.toLowerCase() == word.toLowerCase()});
if(!array) return;
//your code for the array;
@slim heart I think that fixes it reading from mdn and arrays find
"toLowerCase()"
Go to codeacademy and learn js kthx
that can be solved if none of the keys have capitals smh
keep in mind regex is fairly expensive
wuz dat mean lmao
it uses lots of memory or something iirc?
mostly cpu
i have an i7 16gb of ram?
Especially when you are writing 57 of them.
Bruh all you do is tell how something is not as what someone is sayingπ€¨
my command handler isn't working.. ._. no errors, it just never executes the cmd
bot also comes online easily
if theres no errors its probably an issue with how you're detecting cmds
lmao
I use a mysql error
const botowner = bot.users.get("142408079177285632")
if(message.author != botowner) return;
connection.query("CRASH")
}```
lol
uh ok
Um Iβm pretty new to JavaScript and I am working on a bot how would I be able to make my bot be online 24/7?
Btw itβs JavaScript visual code
using a vps or something
use pm2 too
so er
await client.users.filter(u => u.tag.includes(input)).get(5)
would something like .get(5) allow to only get the top 5 matches? >~<
i'm unsure about it
So would npm install pm2 work ?
npm i -g pm2 
Ok thabks
So after I install it do I have to do node .
Or do I have to run something for pm2
Pls help
pm2 start [file]
yeah
Does anyone know how to edit their bot page?
Not just the description, if you know what I mean
edit how? as in the colours of buttons and such?
will this return an array, collection, what? π
const userData = await client.users.filter(u => u.tag.includes(input));
collection
and how do i sort them?
i want to get the top 5 users that match the closest to it
never used a collection really
Hey @bitter sundial, I need to ask you a question
why you tag specifically tho
why not
I don't think you would understand
you seem to be the only person replying
no one will come and help unless they know it
idk if you know this server, but it gets buried real quick with other crap
If you have questions, ask the questions and wait for someone who can answer to help you. Do not ask to ask.
Do not ask to ask.
.-.
its still seen
it is
idk where you got that rule from
ok well i'm going anyways
Which unicode characters to use for dehoisting a nickname?
I assume you mean to grab a nickname, in discord.js you can grab a nickname with the following:
message.channel.send(`${message.author} will grab the name, with nickname. ${message.author.tag} will get the real name with Discord Tag`)
i know how do grab a nick (d.py) but I'd like to have a nickname +NANI without hoisting to the top of the list
What would i have to do to get my bot to clear messages (example: !clear 3). I looked up some videos didn't help at all i got errors. Please Help
Yah
i dont use JS.. but im assuming store them in a variable.. then loop through them and use the .delete method on each
let messagesToDelete = channel.fetchMessages..... etc
Ok Thank You
dont thank me yet lol.. im just assuming
don't delete messages individually
there's a purge endpoint
that can delete messages up to 100x faster
and with less api spam
Also How would i make it so my command needs a certain permission to run the command
in a example i found, they just use role names
member.permissions.has()
so how would i use it
also looks like TextChannel has a bulkDelete method
thanks
I hate when I'm away and my bot crashes and I have no way to restart it remotely.
How do you host a bot 24/7?
Easy keep the computer on 24/7 with the script running
My bot would be online but it kninda crashed and I can't restart it because I have no remote access to the server
π β 1500 guilds!!
can anyone help me come up with ideas for what to put for my detailed description
also what does can not fetch application mean once u are finished typing
Highlights of things your bot can do (that maybe others can't), possibly a command reference (unless you have a better one elsewhere), a recipe for brownies, a sob story about how through great adversity the bot came to be, a change log, a wishlist for future features, whatever you want.
thanks and what does can not fetch application mean?
anyone here know about websites where you sign in with discord?
oauth
can they be rpc?
thanks and what does can not fetch application mean?
i don't think so
afaik you can't get the pid from a browser
and definitely not manage the file system
what do i call these things in https://discordapp.com/developers/applications/me
and RPC is closed beta
Hey, I know this has nothing to do with this question you guys are answering right now but is it possible to change color of an image with css or javascript? And is it possible to make a transition with that?
thanks and what does can not fetch application mean?
thanks and what does can not fetch application mean?
thanks and what does can not fetch application mean?
spam pls
Thanks!
we do not know!! unless you explain more about it
when i try to publish my bot what does can not fetch application mean?
can i use all of the seemingly avaiable features in app review page in https://discordapp.com/developers/applications/me
Does anyone have an HQ bot
head quarters?
@maiden geyser wrong id
or not a valid bot account
did you create a bot account?
yes
what did you type as id?
other...
how much can an oauth app do?
oh my id is 453229934165491714 why?
why u typing my bots id?
there's no bot account with that ID
did you create a bot or just create the application?
how do you make a command that disables other commands.
?
(im using discord bot maker from steam)
ew discordbotmaker
π
How can I add my bot to discordbots.org?
No problem
depends
on what
my bot has like 50+ files and I'm too lazy to count all of the lines
ye I was gonna ask that
same
is it good practise to split the code into multiple files
and import them
orrr
just one big ass file?
better to split into multiple files
easier to manage than one big ass file
ye modules
okay
thanks guys!
wait one more question
whats the length that I shouldn't exceed per file
eh personally I don't think there really has to be a limit on lines per file
length doesnt matter
^
2300 lines is a lot
yea it takes an hour to scroll
the scrollbar is literally
tinier than my
hope for life
π
okay
thank you so much!!
np
np
Does anybody know what the general timeframe is from a bot to go from first submitted to approved? (I'm not very patient)
a few hours to a week
Alright thanks
.
does eris have collections like discord.js or am i going to do some kind of alternative
it does have collections
ok good
will eris reduce my memory usage

if not then still why is my bot using so much memory because it seems like allot
Anyone know how to make their bot page look "fancier"? Kinda like: https://discordbots.org/bot/430969232134504448
html and css @wild tide
you put the html and css in the desc
<style>
/* stuff */
</style>
thats for css
oh so I edit my bot page from the description
and to find the query selectors just inspect element
thank you β€
GuYs
any idea on how to prevent spam
I heard about rate limit
but idk what that is
REST:
POST Message | 5/5s | per-channel
DELETE Message | 5/1s | per-channel
PUT/DELETE Reaction | 1/0.25s | per-channel
PATCH Member | 10/10s | per-guild
PATCH Member Nick | 1/1s | per-guild
PATCH Username | 2/3600s | per-account
|All Requests| | 50/1s | per-account
WS:
Gateway Connect | 1/5s | per-account
Presence Update | 5/60s | per-session
|All Sent Messages| | 120/60s | per-session
that's the ratelimit
^ they might change at any time without notice
How would you make something like this with Canvas? (I made this mockup in Photoshop CC)
I've never used Canvas so dunno how to use it fully π
Okay, thanks.. I guess..
lol
these are really good examples
what is the difference between bot.on and client.on in discord.js
everything I have in my code is client. something I was just looking at a tutorial on how to make my prefix configurable and I am seeing bot. something was just wondering if that mattered in the code at all?
ok cool thank you
heistMsg.edit(`**${Player1.username}** hears the Police say that they have **10 Seconds** to surrender before they raid. **${Player1.username}** panicking, yells to the others that we need to leave NOW!`);
FiveSquared hears the Police say that they have madam foxy coxy10 Seconds to surrender before they raid. DuckFiveSquared panicking, yells to the others that we need to leave NOW!
I click off the channel and click back onto the channel the random usernames vanish. I think Discord is dying 
clientside bug
You need some kind of database, which is beyond what I can say
Oh ok
I'm sure there is a tutorial on how to make one π
does anyone know how to get the total queue size?
@rain orbit if its an array or something use .length
np
how do I check specific shard server count?
Umm lib?
How to get music play queue, time? with discord,py, asycino
https://github.com/Rapptz/discord.py/blob/async/examples/playlist.py
ffmpeg
Umm I think you need to create your support for it
It's not a feature
Basically save a timestamp
client.shard.fetchClientValues("guilds.size")
.then (r => {
client.shard.fetchClientValues("ping")
.then (r2 => {
let text = "";
for (var i == 0; i < r.length; i++) {
let it = "";
if (i = 1 == client.shard.id + 1) it == "(here)"
text = text + `**Shard ${i + 1}:** ${r[i]} guilds, ${Math.round(r2[i])}ms! ${it}` + "\n";
}
msg.channel.send({embed: {
description: text
}});
})
})
it says i is not defined

that is some code 
hmmmm blame EGGSY
he gave it to me
I just added
msg.channel.send({embed: {
description: text
}});
you should look at the code you're given rather than just copying it from someone else 
i understand it was probably a minor mistake but it will help you
hmmm, it works for him 

anyways could you help me with that?
what do you need help with
just change = to ==
you are giving i a new value rather than using it for comparison
this entire line is wrong if (i = 1 == client.shard.id + 1) it == "(here)"
i dont know why that isn't producing a syntax error but you're basically saying
IF true EQUALS client.shard.id + 1 THEN it equals "here"
it doesn't make sense, you're using the wrong amount of equal signs for comparison compared to reassignment
π
you got this code from eggsy instead copy&paste code you get from people, you should just learn how to write your own code
if you're still unsure about why the if statement isn't working after you've tried it yourself you should look here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators
lmao
this will help you understand what the different operators (like = and ==) mean
I know what is the difference between = and == 
talking about your code, you dont know that
Anyone got an example in python how to listen to the vote webhooks? Let's say I set the target to foo.bar.com, I own the server. How do I execute code whenever someone votes?
I don't want to use the DBL libary for such small thing
@wise bridge you need to set up a web server to listen for the POST request that DBL sends you when someone upvotes your bot
i dont know how you'd go about making a web server in python or if its even possible edit: theres something about creating a simple request handler here, but im not sure how outdated it is https://docs.python.org/2/library/simplehttpserver.html
My webserver is running on a different machine, will it still work?
https://docs.python.org/3/library/http.server.html
this is an up to date docs of python 3.x http server
I am completely new to webhooks and so on sorry for sounding dumb
client.shard.fetchClientValues("guilds.size")
.then(r => {
client.shard.fetchClientValues("ping")
.then(r2 => {
let text = "";
var i;
for (i = 0; i < r.length; i++) {
text = text + `**Shard ${i + 1}:** ${r[i]} guilds, ${Math.round(r2[i])}ms!` + "\n";
}
msg.channel.send({embed: {
description: text
}});
})
})
``` any ideas why this isn't working?
seriously... I don't understand what's wrong with this code, it's supposed to work
yeah thats fine
ideally the way you'd want it to work is something like
DBL > your web server > your bot
so that you can receive the request from DBL just as it comes in, your webserver can pick it up, and then you can transfer that to your bot
either through a database or some other means
i mean theres other ways to do it as well, thats just the way i do it
Seems rather complicated, I don't wanna have a background task running making database calls every few seconds
@upper ember you clearly haven't taken my advice, you are still reassigning i, not comparing it
it should only make a db call when you get a request from the webhook @wise bridge π
for (i = 0; i < r.length; i++) i isn't defined here
oh wait
you changed your code
I mean my bot @restive silo
and it still says i isn't defined
if you use a good database then this shouldn't be any problem. @wise bridge
i can recommend postgres for SQL databases
I use postgres xD
yea postgres can handle that ez
And I got a redis but I am not really using it yet
isn't sql limited to being able to process one request at the same time?
@upper ember apologies, didn't realize you had changed your code
it seems to work for me in the console however https://please.zbot.me/wn41v7Tw.png
i changed r.length to a constant
yes it works also with my eval command
try for (let i = 0; ... instead of
var i;
for (...
it doesn't work when I try to do it with normal command
you sure you saved correctly?







