#development
1 messages Β· Page 581 of 1
I got my files in a VPS, (node.js) How can I run it? npm run dev isnt working now
I get this error ```> my-bot@1.0.0 dev /home/dakota/SeekerBot
nodemon index.js
/usr/bin/env: 'node': No such file or directory
npm ERR! Linux 2.6.32-042stab120.19
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "dev"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! my-bot@1.0.0 dev: nodemon index.js
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the my-bot@1.0.0 dev script 'nodemon index.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the my-bot package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! nodemon index.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs my-bot
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls my-bot
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/dakota/SeekerBot/npm-debug.log```
"'node': no such file or directory"
I made sure node was installed
@rocky dagger you define coinUser in line 8, coinUser is not a valid property within discord's message object so it errors on line 11 since it can't access a property that doesn't exist
drop the message. part wherever you do message.coinUser and try again
Does anyone here use discordia?
I'm just starting with it and I need some knowledge :p
discord.ia?
i use discord.js
@marble needle Thx
How can I play an mp3 file on command (please keep it simple) (the mp3 file is in the folder)
You think the Amazon EC2 is good for hosting? Or should I do GCP?
@earnest phoenix can't just ask that, we need additional information, such as, what library are you using?
@dusky marsh Windows / Destop/MyBot <--- JS
Okay, that doesn't answer my question, tho I'll assume you're using Discord.js
Read that. And if you have future questions, it'd be easier for everyone involved if you asked clear and concise questions.
what i do for my bot answer a people by mention if her was with a nickname ?
@earnest phoenix what library
if(<message>.mentions.users.first().id == <client>.user.id) {/*handle if mentioned*/}
ty
For the box containing a long description for my bot, i cannot seem to get the correct css class to alter the background color for it, i'm quite new to css and html, the screenshot below is the classes/ids and such, i can't seem to select the proper one to apply the attributes to.
(this is for my bot's dbl homepage by the way, if anyone is unsure)
The classes you need are .longdescription.content
With a space
It would be .container .longdescription .content
If you can't get it in the first scope, just keep elevating the scope until you override the css
.container .longdescription .content {
// stuff in here
}
so this would be the correct syntax?
Yh
Yeah
I dont use the .container
You should
Doesn't matter really
for classes it doesnt matter as long as it has good enough specificity and finds it
but for IDs, you should use them if you can
css scans the whole document to find classes, but it gets the ID directly from memory. so if you use #id .class the css will only scan that specific ID for classes, not the whole document
IDs also give you a shortcut in javascript, so you dont need to use getElementById. example:
<element id="test">
ok
</element>
<script>
console.log(test.innerHTML) // ok
</script>```
holy shit tim i never knew about that that makes life so much simpler thank
what's a good vps to buy? friend's asking me
Can someone tell me what can i do to avoid this: Ignoring exception in command None
discord.ext.commands.errors.CommandNotFound: Command "ping" is not found
This problem comes out after adding this:
@client.command(pass_context = True)
async def owping(ctx):
msg = await client.say("**Pinging...**")
ms = (msg.timestamp-ctx.message.timestamp).total_seconds() * 1000
embed = discord.Embed(title = "β± {}ms".format(int(ms)), color = 0x50D050)
await client.edit_message(msg, new_content = " ", embed = embed)
// Get 10 values of DATA if x=...
var values = []
let parsed_data = new Expression(DATA).parse()
for(var i=0;i<10;i++) {
values[i] = eval(`var x = ${i};${parsed_data};`);
}
//End
//Push to base chart
var valueForChart = []
for(var i=0;i<10;i++) {
valueForChart[i] = {
"x": i,
"y": values[i],
"c": 0
}
}```
this gives me
```json
[ { x: 0, y: 2, c: 0 },
{ x: 1, y: 0, c: 0 },
{ x: 2, y: 6, c: 0 },
{ x: 3, y: 4, c: 0 },
{ x: 4, y: 10, c: 0 },
{ x: 5, y: 8, c: 0 },
{ x: 6, y: 14, c: 0 },
{ x: 7, y: 12, c: 0 },
{ x: 8, y: 18, c: 0 },
{ x: 9, y: 16, c: 0 } ]```
when i put `2x^2`
and in result gives me this;
https://img.jt3ch.net/99898e1e.png
which is clearly completely off
Anyone might be able to help?
it looks like it's using ^ for xor
How to do in a server we can do an command to set the welcome channel for my bot Someone can help me pls? (Language: JavaScript)
have a database
allow the user to define a channel, then store that channel's id in the database
no if I am in this server for example I do a command like *setwekcomechannel (channel) In any server and different for all serveur
https://goo.gl/EP3oxJ
Learn Python - Free Interactive Python Tutorial
https://goo.gl/hQSzc9
Learn Python 3 | Codecademy
https://goo.gl/Wm8ZPh
Learn Python the Hard Way
@ember shard
HOW DO I OPEN THE BOTS CODE
Do you know how to code in Python?
Do you know asynchronous code in Python?
No
https://youtu.be/5yahh4tR0L0
π₯ Discord.py: Making a Discord bot (Part 1: Setup)
https://youtu.be/xdg39s4HSJQ
π₯ Discord.py Rewrite Tutorial #1 - How to Create a Discord Bot With Python
In this video, we go over the setup process for creating a discord bot in python. Command Prompt Commands: python -m pip install -U discord.py python -m pip ...
This discord.py rewrite tutorial will show you how to create a discord bot with python. We will be using dicord.py rewrite, the newest version of discord.py....
Ok thanks
I would use rewrite (2nd link)
Ok
and plus a tutor would help
Wdym tutor?
well i mean an instructor if you're wanting to learn more python
Ya can search the internet but I digress
@late hill yes, a category is actually a type of channel
what would the regex for if the string doesnt only have permitted characters
So like for example i only want 0-9 and the letter A
So:
"2a 912938" => false
"b" => true
"2a0912312 b" => true
wait
oh hm
one sec
[^0-9a]
if you just do that
and do like
matches any
it wont match the whole thing
instead of / /g?
?
lul
@hushed berry wait is there a way to do it like conditional in the regex?
what are you trying to accomplish
cuz i kinda wanna do the .exec so that i can get the specific part of the string that wasnt allowed
doing ! would just return false and whatnot or the things that it's supposed to be
smh
For peeps that use source control, do yous use source control with a second bot and just update your main bot upon updates?
what's the go?
Like, how would I efficiently run certain versions only while being able to add stuff?
I have a test bot to test fatures before adding them to my main bots
If someone isn't in the servers my bot is in, then they can't DM the bot right?
I can check if you want, what's your bot's name and tag?
@sick vine yes, you need a mutual server
Ok good.
I disbanded a server due to drama and I don't need them trying to use my bots
Anyone have idea how to reduce cpu usage of my bot? I have 2 cpu cores at my vps and my bot only in 700+ server but they're using 100% of cpu :(
Yes figured it out
then fix them 
using css
google it
no
CSS is literally the easiest thing to learn
you don't even have to learn it
just copy paste the code from the site
use F12 to open up chrome's dev tools and use the selector tool to pick what element you want to change the CSS of
figure out the class/ID's and element names and place that in the long description as CSS
for example
you have an element called
<div id="first">
<div class="second">
<third>
Text
</third>
</div>
</div>
#first .second third{
color:text-color-here;
background:some-background-color;
}
#first .second{
/* more styles for .second */
}
#first{
/* styles for #first */
}
no
that is the website's CSS
that's my CSS lmao
whatever is in the element with the class ".longdescription"
it's not imported as a CSS sheet
it's injected directly into the HTML as a style tag
i explained that earlier
no you haven't
you found thenewstyle.css which is my CSS which is the sites CSS
yes
CSS is easy to learn but hard to master
this is when i change my region server to Singapore, Japan, and Hong-kong.
It returns this error. But, if i change it to the London for the example...
It will leave by itself and no error return.
I hosted on DigitalOcean.
Is it problem from my VPS or Discord?
What would be the best way to get the id of the @ everyone role using Eris π
guild.roles.find(role => role.position === 0) I guess
Thanks for the help bois
oh wow
π
How to use async ?
https://hastebin.com/utapifehaz.js
When i pay someone and check balance , balance becomes undefined.. its nothing wrong with the balance command but this command messing something up
@earnest phoenix you use "await" in an async function to await data
hi
Use a database
Also doesn't make much sense that you're using an object for just 1 value
this is probably an issue
Another issue is that your code doesn't check for negative values
Which means user a could pay user b a negative amount to steal their money
fix those things π
hi
Node.js How can I add a music feature to my bot? Like it searches youtube and plays it if person is in a voice channel?
people nowadays use lavalink
Duh
what a no neccesarsry bot
why do you care lmao
because that bot hacked my account
cool
Doubt it
How can a bot hack your account though
your token
How does it get that?
In google chrome
Checked the invite link, redirects to nothing
Applications don't get access to user tokens
Even through the OAuth2 page
Press F12 => Application => Local Storage => https://discordapp.com/ and find the token or watch this video:
https://youtu.be/HT1GyN6fJ5A
Discord
Step up your game with a modern voice & text chat app. Crystal clear voice, multiple server and channel support, mobile apps, and more.
Tutoriel effectue sur discord ^^
that's called logging in
π
question is about how a bot can get a token (it fucking cant)
posts video about how you can get your own user token
9000 iq
tl;dr there is no way for a bot using the discord api to get access to your account, therefore a bot cannot hack your account.
I spyk theu anglishe trer bi1
not even google translate can fix that sentence
highly enjoy how you link to an outdated video aswell
discord stopped storing tokens in local storage for months
you can still find them in api request headers, either being the case you're not gonna grab anyone's token with a bot
mfw you answer my question before typing it out
Okay, to clean up servers, how can I make my bot DM a help message?
Oh right, yea
So lets say, client.on('message', msg => { if (msg.content === '$help') { msg.reply('help message'); } }); would become client.on('message', msg => { if (msg.content === '$help') { <user>.send('help message'); } });
no s my h
<> means placeholder
in that case it would msg.author.send
but dont make a new event listener for every command
Ok, thank you man!
wait
And I know it was an example
hi guys
which library again are you using?
Me?
just post your question
About sequence diagram
yes @rotund sinew
Discord.js
ah
node.js
node.js isnt a lib
i thought msg.channel.send('message') would work for it to reply too?
he wants to dm a help message
oh
BOOM worked, thanks man
yw
Nah I got it to reply, I wanted it to send a DM
know
the
difference 
Javascript is a language,
nodejs is a run-time environment,
eris and djs are libraries
Ik
Ok, I made a program for 8ball, pretty easy? Well, I need the people to ask the question and the bot repeats it before the answer.
var rand = ['Yes', 'No', 'Why are you even trying?', 'What do you think? NO', 'Maybe', 'Never', 'Yep'];
return rand[Math.floor(Math.random()*rand.length)];
}
client.on('message', msg => {
if (msg.content === '$8ball') {
msg.reply('Your anwser is: ' + doMagic8BallVoodoo());
}
});```
Currently you just say $8ball and it works
Javascript
yes.. i dont know java i use python lol
Or, I mean Discord.js
Oof
Ok, I made a program for 8ball, pretty easy? Well, I need the people to ask the question and the bot repeats it before the answer.
var rand = ['Yes', 'No', 'Why are you even trying?', 'What do you think? NO', 'Maybe', 'Never', 'Yep'];
return rand[Math.floor(Math.random()*rand.length)];
}
client.on('message', msg => {
if (msg.content === '$8ball') {
msg.reply('Your anwser is: ' + doMagic8BallVoodoo());
}
});```
Currently you just say $8ball and it works
why dis not work!?!?
if message.content.startswith('/8ball'):
randomlist = ["The sky says most likely", "The moon says not", "INEEDIDEAS", "I would say its a maybe"
are you getting any errors?
nope
are you sending anything back?
Nope, just wont run if I add the question
do you send anything to the channel after defining the randomlist
send the full /8ball code
@rotund sinew because you are checking exactly for $8ball so if my message is $8ball hi it wont work because it isnt exactly $8ball
you would need to use message.content.startsWith
var rand = ['Yes', 'No', 'Why are you even trying?', 'What do you think? NO', 'Maybe', 'Never', 'Yep'];
return rand[Math.floor(Math.random()*rand.length)];
}
client.on('message', msg => {
if (message.content.startswith === '$8ball') {
msg.reply('Your answer is: ' + doMagic8BallVoodoo());
}
});``` doesnt work
startsWith
Yep
not startswith
one second you define the incoming message as msg then check for message.content
how did that even reply in the first place then
var rand = ['Yes', 'No', 'Why are you even trying?', 'What do you think? NO', 'Maybe', 'Never', 'Yep'];
return rand[Math.floor(Math.random()*rand.length)];
}
client.on('message', message => {
if (message.content.startsWith === '$8ball') {
msg.reply('Your answer is: ' + doMagic8BallVoodoo());
}
});``` doesn't work either
^^
function doMagic8BallVoodoo() {
var rand = ['Yes', 'No', 'Why are you even trying?', 'What do you think? NO', 'Maybe', 'Never', 'Yep'];
return rand[Math.floor(Math.random()*rand.length)];
}
client.on('message', message => {
if (message.content.startsWith === '$8ball') {
message.reply('Your answer is: ' + doMagic8BallVoodoo());
}
});
Doesnt work either
would you mind sharing the error for once
Why is it that making discord boots attracts people who know little to nothing
Bots* fuckin ac
Because they like to think it is the best first project to tackle, for some reason.
For some reason indeed, a reason I have yet to find lmao
Ok... I am sorry for asking so many questions
How hard can it be to make a discord bot. It only like needs to listen and answer
If you're a bot, that's all you need your bot to do.
if (message.content.startsWith("$ban")) {
if(!message.member.roles.find("name", "MODS"))
return;
// Easy way to get member object though mentions.
var member= message.mentions.members.first();
// No mentions catch
if (member === undefined) return;
// Sends them a message
msg.member.send('You have been banned');
// Kick
member.ban().then((member) => {
// Successmessage
message.channel.send(":wave: " + member.displayName + " has been successfully banned https://gfycat.com/playfulfittingcaribou :point_right: ");
}).catch(() => {
// Failmessage
message.channel.send("Access Denied");
});
}
});``` sends the DM to whoever did the ban, I am trying to make it message whoever was banned.

Alright, to be fair, I have quite a few "unfinished" comments in my code.
The idea is to help you out in reading. It doesn't need to be perfect to be helpful.
@mossy vine Thats because I just edited my kick command

But yea, I don't get how to send it to them
You shouldn't have multiple message listeners.
^^^^^^^
tHIS IS WHY
great
Use a command handler instead.
ignore it @rotund sinew
You'll need some decent changes to your code, in general. Ignoring what you are trying to do, there are some things that should be changed just to make the bot run better as a whole.
Sometimes I wish I knew more js just so I could see how stupid some people are with their discord bots
dont need to know a lot of js to smell the bullshittery that's going on in here on a daily basis
Well Bypass, Im just making the structure now then gonna make it run smoother after it works
pushing those mem leaks as far as your toaster can pull heh
Has anyone made a library comparison that doesn't just compare API coverage?
I mean something like saying what features the language/library provide
No need for it to store anything
msg.member is a GuildMember, so is member in your code.
https://discord.js.org/#/docs/main/stable/class/GuildMember?scrollTo=send
Also message.member.roles.find("name", "MODS") is a deprecated way of using .find. Use the function equivalent instead.
https://discord.js.org/#/docs/main/stable/class/Collection?scrollTo=find
Correct me if I'm wrong, but seeing that slack and discord are nearly identical in user interface, are they the same on the back end as well? A discord bot would be easily slotted into slack?
Anyone knows why this returns "None"?
https://pastebin.com/iBJqLvuZ
(python)
Well prints 'None' is what I mean.
While running the subcommand 'list'.
@mossy vine We will be using bots to address equipment FAQ. Our company is based on sales/installation/maintenance of equipment. We have more maintenance personnel in the field than our office staff.
So having FAQ bots setup for specific pieces of equipment in specific channels would be great.
But other than the API, I would probably be able to repurpose it sounds like.
if you need to have it both in discord and slack you could write an abstraction layer over the actual platform
so you can reuse code between both
and only change what service is being used
I only need it in slack
but it would be nice to be able to copy and paste some functions from discord bots.
@ruby talon could you post that on hastebin?
Hastebin is a bit buggy for me.
I'll try tho.
Well
It doesn't seem to be working;
You can do it if you want to you have the code from pastebin.
Discord and slack have very different backends iirc
I can never get Hastebin to work.
Me either
https://ghostbin.com/paste/urmry @ruby talon I uploaded it to Ghostbin (my preference) just in case it helps someone else out.
Wish I knew a bit more Python so I could help
Thanks tho. ^^
gists are kinda annoying tbh
..........
That's not how you are supposed to debug your bot, not at all
also if your function doesn't need to deal with async code, there's no need to async def it
Your command prints None because aa() isn't returning anything
also those try except blocks are useless because there's never anything that would raise some error in those blocks
it's like expecting
try:
a = 1
except:
to throw an error.....
@ruby talon You still here?
explain me where did you learn how to python?
its more of a programming at its core concept problem rather than the language he uses
well yeah, but he is trying to use python, so I asked where did he learn it
Partly from myself, learning from other ppl there code and udemy (havn't finished that course yet tho).
And btw your statement: "Your command prints None because aa() isn't returning anything" isn't true since it just didn't meet the requirements to return something, because there is a difference in objects thats why it doesn't work.
And previously there was more code in those blocks so they stayed there for now.
and it doesnt work without async, believe me I tried.
But its fixed, I found it myself, it was a stupid mistake.
didn't meet requirements to return == doesn't return anything
also your if statements will always be false. discord.Status is an enum, not a string
and somehow having duplicate code and function definitions per for loop step is not a mistake ???
brooo chill, I prefer to first fix a problem and then optimize the code lol
works faster for me.
"optimze" is used lightly in this context
pasting the same block of code all over the place isn't what programming is about, your goal is to have it in one place and be able to use it wherever
I think I could have the same command be one-liner
well
do it then IDC, but hf.
I would be happier if my code would run in place of it 'looking clean'.
(and most 1 liners aren't clean lol)
But I'm going further, have a great day!
π
I don't want mine clean
And a tip endu for the future, don't make your messages so insulting.
It might not be ment that way but it really pissed me off for a sec.
Maybe add your opinion ect as tips then it will get appriciated.
π
I mean, if facts piss you off then
Our server keeps getting chain mail sent that spams the chat with huge text art. Any ideas how i could create a filter for them?
I just mean you could say it on another way.
Arthur, you should really learn how to program, just because your code works, doesn't mean you know how to program
also, I did make your entire code a oneliner:
Well not really.
Wait
all he did was make you aware of clear structural errors, that's what happens if you ask questions in a software development, people will tell you what else is wrong with your code
Whats that code do?
Counts the status of members in this server
So this would ctx.send(", ".join([f"{s}: {sum(1 for m in guild.members if m.status == s)}" for s in discord.Status]))
@marble needle I appriciate the critique, I just wanna help him prevent pission off other members that have been in a "bad" mood for the day.
Its not like I'm angry at you Endu xD
Endu, I wanted to get the amount online membs of a role.
But thanks tho.
Online members are litterally all - offline
@split hazel you could pick a few characters used in the art that are uncommon/don't usually occur in regular chat messages, filter message content based on those ascii art characters and delete them if the message contains whatever be it one, two or thirty of them
I should do that.
ty xp
@split hazel Or you know, enable slowmode
@marble needle Maybe use it like if more than 70% of the message has those chars del those.
ctx.send(", ".join([f"{s}: {sum(1 for m in guild.members if m.status == s)}" for s in discord.Status]))
}``` Doesn't work
ehm
You said it counts members
Js
for the love of god, stop whatever you are doing and read through all the content including links that are pinned in this channel
what the fuck is that code
LOL
copied some py eval command someone posted above and threw it into js
pythonscript
cry, hahaha you should invent that.
People already did, but nobody wants to make it a reality
why would you want scripting language for html that looks kinda like python but is nothing like python
this > pythonscript https://www.emojicode.org/
Emojicode is a full-blown programming language consisting of emojis.
Endu, can I ask you a question?
π
with a function in python when you return more than 1 item, how do you do that?
Like for example:
def foo():
return False, 'bar'
How would you print the bar or get the False?
I'm probb stupid for not knowing this xD.
And could you do this in your return func?
barcount = 0
def foo():
return 'bar', barcount +=1
ok, ty
no, you can't execute statements like that
thanks. ^^
client.user.setGame("$help for Commands"); Can I make it like those others that say Playing <number of servers>
Oh right, djs
${expression} in the syntax would be the server count
are you aware of what expressions are in programming(or js)
client.user.setGame( ${expression} + "|| $help");
Yes I know what they are, I don't know what expression I would use
thats also not how template literals work
`${<expression>} and some other stuff`
you use backticks to wrap around the templated string
read the djs docs and figure out how to get the server count lol
also, .setGame is deprecated, use .setActivity
When you attempt to code a bot but don't know the difference between javascript and python
Few posibilities
I think that #topgg-api is more appropiate.
And ehm, are you using discord.py rewrite or the async version?
If you're using async its normal that it doesn't work with just copying it.
Are you using your secret dbl bot token thingie?
discord.py rewrite is a bad lib for programming bots in python?
itβs a rewrite, hence supposed to be better than the original build lol
how can i add a full string of a few characters to an already made /[0-9jkdnjewj]/ because if i add the specific string to it then itll count any of the letter into it instead of it all combined
https://pastebin.com/pjDmjvn5 this.create isnt a function , what should i switch it to?
Did you check the docs?
Couldn't find it.
(used control f)
I tought by doing discord.Object but seems like that only worked on async.
Exept if I'm trying to send the message wrong.
You using discord.js?
My code representation:
channel = discord.Object(id='123456789')
await channel.send('foo-bar')
No discord.py.
Rewrite.
IDK py, sorry
np ^^
Next time you might want to say what lib your using π , it's help you as much as it helps know what you trying to do, on what lib
Yes.
I'm sorry forgot it this time.
It's all good
Just the sec I found it lol.
https://discordpy.readthedocs.io/en/rewrite/migrating.html
xD
Timing, ty tho lmao.
π
I'm using DiscordRB, and is there a way to check if a channel is NSFW? I looked at the documentation and it mentions channel#nsfw and channel#nsfw?, but I tried both of those and got an Undefined Method error
maybe it has to do with Discord changing how NSFW status was handled, since the library was made?
https://pastebin.com/3cuxYjjM money gets taken out the users balance but doesnt get sent to the other
Anyone have giveaway command
Yes.
https://pastebin.com/dMkjJALA & https://pastebin.com/PcFMj42q command runs but nothing is taken from or added to either of the balances.. plz help
process.exit() is normally a good solve-all solution to bugs
if someone connected to steam on his discord, is there a way for me to get his steam link using JDA ?
tag me if u answer plz
afaik there is no way to get a users connected accounts with the api
if there was an error i wouldve posted it
ngl this is why I hate that db I could never understand how it actually worked so I settled with something simple 
The difference is big 
have you tried debugging?
no
the simplest form of debugging is adding console.log in all relevant lines and log all relevant variables to see where it breaks
then do this
this is what i get back
i literally got it working then it randomly broke again i didnt even touch anything
console.log(global.db.get(relevantuser))
// update user code
console.log(global.db.get(relevantuser))
// update user code 2
console.log(global.db.get(relevantuser))```
or equivalent
i mean
do it the same way you do to get the user from the database
the idea is to read the user, then update the database, then read the user again, to see if the value was updated or not
and do this on each line that affects the database
if the database is not updated in a specific line, that means the sql query on that line is the problem
Any easy way to detect if message contains discord invite link π€
do you think that this part could be the problem?
What exactly are you typing as the command Sushi? Because from my understanding, amount is set to 0
Lol
Nice.
thanx
β€
brings me back to my original problem , the bot allows me to gift someone an amount of coins that i dont even have, and that breaks the whole database
Because you didn't return on line 24. ("Not enough Stripes")
T-T how do i reset it lol
i did
not in the link i gave you
wait maybe i didnt tho
is there a way for me to reset the database? cuz its broken
If you want to delete all the rows in a table DELETE FROM tableName
@long cipher to continue,
It's not defined because you didn't define it.
how would i define it
Plz help
I did
no you really didn't
Help
Plz
You have something wrong with your invite. Simple
Also, you can't add the bot to this server. Only people with perms can do that.
Ik
Iβm trying to add it to my test server
Like I said, you have something wrong with your invite.
Is it the account iβd?
A small calculator that generates Discord OAuth invite links
That didnβt work
is lavalink meant to use a lot of ram
only 1 stream of music uses like 90% of my ram
and i have 8gb ram
can anyone help me?
@earnest phoenix It uses a significant amount of compared to ffmpeg but not that much iirc...
are you sure a memory leak is not going on or you are not creating multiple instances?
is it lavalink or your code?
that and lavalink is java, its going to eat your ram over a longer period of time
yes but in my usage, mine is staying at 2gb
as well is it really in lavalink and not his code
I'm having trouble hosting my bot on deploys.io. Basically I bought the discord bot hostage package for a NodeJS bot and I keep running out of RAM apparently.
My bot simply responds with a link when tit see's the command in chat
I contacted support and they told me the server keeps running out of memory (its' only around 70MB, i know that's nothing in sense of modern day RAM but it's a simple bot with one functiom)
only costed 3 euros lol
Deploys.io
Deploys.io Hosting. Providing remarkably high-quality servers at a very affordable rate.
they seem legit
its a scam
I just wanted a simple service for a simple bot
yeah it is legit but its a huge ripoff
Any recommendations for hosting?
galaxygate
Thing is the bot worked for a day r two
Scaleway
Scaleway provides SSD cloud servers with a simple and flexible pricing. Enjoy a predictable cloud pricing model starting at β¬1.99 per month.
digitalocean
ty
2 euros for 1 gb vps
In discord js, How would I get the first x amount of messages from a collection? I have a purge command that fetches messages in a channel then filters them by user id and I need to delete x amount of them
@knotty steeple no bad host
no u
yes u
@earnest phoenix just specify a smaller max heap, it's as simple as that
putting a band aid on the problem is not solving it
Band aids are good for the process of solving it
nice
just ask the question, don't ask to ask
Eh, no reason in asking an entire question when someone may not answer.
Β―_(γ)_/Β―
My bad.
just tell the question
Just curious if anyone has ran a bot on a RPI3, with a high server count, possibly using sharding.
no
RPI3 farm? π€
rpi is limited in many ways
i dont use pi
if you don't need a lot of resources (aka no music) you can run a few thousand guilds on an rpi
Oh, alright, that's good to know. Won't be doing music, image rendering, etc.
in python, how would you get a datetime.datetime object representing 2 weeks ago from now?
nvm, got it working finally
@ruby dust How did you do it?
why did I have a feeling that someone will question me
there's a thing called datetime.timedelta
I wanted to use it for purge(), but the only way to make use of it properly is with after, but then there's this
it basically forces it to be True if you specified after, idk why but that messes up the purge
Someone can work good with java Strings?
Please DM
just ask the question
(Need help with string.matches)
To check if message contains discord invite link
I tried some regex's but they dont work
make your own regex
@mossy vine I did, still not working
@bright meadow String#matches checks if a pattern matches the entire string
so its not the method you're really looking for
Alright, I'm putting this in a img in html and the image height resizes, but not the width
Well now it's working, but it wont center
Now it works
didnt change anything

Use css
No point it works now
Next time use css
let platform = "";
const filter = m => m.author.id === message.author.id;
message.reply("Please chose a username. This will expire in 15 seconds...").then(q => q.delete(15000))
message.channel.awaitMessages(filter, {
max: 1,
time: 15000
}).then(collected => {
collected.delete(15000);
if (collected.first().content === 'cancel') {
return message.reply("Canceled.");
}
username = collected.first().content;```
bot doesnt read names that are 3 args or more can someone tell me why?
I don't know tbh, but you use chose and not choose 
i need help
I'm using node.js for my bot and the arguments in bot.on("Message") aren't the same as what I see other people using
I see people indexing the Message to get author, user, and other useful information, but mine is literally just a string and I get "undefined" when I try to index it
Yes
am I doing something wrong?
hiring someone to screenshare and help me with this sqlite3 problem im having , payment will be based off of how much has to be done to fix
YOu need to get access to #434058442764714002
@glacial venture you use discord.js?
I think that's what it is
hold on
it says I have discord.io but no js
i guess I'm using the wrong discord lol
alright I switched and now it works great thanks for the help
I'm trying to make a starboard that only posts if 3 people (not including the person who posted the message) react to the message
what lib?
I'm using discord.js
I remember doing something like that a long time ago
Let me see if I still have it so I can remember what I did
Ah yes
48 lines of amazing code
It doesnt check for reactions on a starboard message though, just the original, suppose I could add it but meh
well 57 now I forgot to add stuff for removing stars 
I mean I dont know how to explain it without giving you the code in a way that isnt obvious already
basically on reaction add if it is a star check it's count
if it's above what you want then add it to a starboard
and save the id, but it's obviously a little more complicated than this
I just cant really explain it better lol
Thanks for answering
im with mac and here is our current code, https://pastebin.com/WEyZ1Drj
we have made it go to the channel but the amount of stars on the message doesnt change
kek
This is what mine looked like
The difference is I store my message ids in a db so you can do one from any time
nice
So I was at a book store today and was looking at Node.JS Training books and was wondering if buying a book is the same as https://discord.js.org/#/ ?
Discord.js. The books are just learning the language not discord bot development.
The book will teach you about the language not the libraries
it's like expecting to find slang in a translation book 
So is the website the best option?
Like I have someone helping me learn it, and most things I already understand.
If I were to get a book to learn, any good ones?
I never read any, so I wouldn't know, sorry
How did you learn?
A lot of self teaching and my high school
So Discord.JS be a good start for me or is there a better one?
I have a bot running now and is basic but I really want to expand it.
I'd say it's an easy lib to use
Yea it's laid out well.
so... i'm trying to make my bot react with an emoji, it's not working, what exactly am i doing wrong?
You need to send the full emoji string

How exactly the full string looks like you can get by adding \ at the beginning of it
Well you could ust do <Emoji>.toString()
Yeah no shit, do it here
Steven no need to make this even more complicated

Thats the full string of 
what does the number represent exactly? making sure
the id
of the emoji
@grim aspen I wasn't saying that bots have to add that symbol to work with emojis, I was saying that you need to use this method to get the full string for the bot to use then
i'm trying to get it to send this emoji when ever it gets pinged: 
\:emoji:
i think it's an error by my system
What
it isnt
How can a string cause a system error?
i mean, instead of sending an emoji, it sends the text instead, your help is helping, but i think it's an error with my bot
the actual emoji
Not too literally
There, now copy and paste that into your code
there
got this error randomly, anyone know what tf it is?
Checked online and theres almost no references regarding it
the only answer i can think of is my bot has evolved and tried to join the vc using google chrome
but i don't think thats very accurate
Also the error is not consistent as its only happened once and was fixed with a bot restart. Not happened since
also code snippet
idk, but cool ide
@earnest phoenix looks like you're using the browser version of discord.js
its normal discord.js
discord.js.
const token = 'NTI4NjU3MzE...........................OXP-uxP-c8'
const discord = require('discord.js')
const client = new discord.Client();
client.login(token)```
the bot is offline
try adding this in your code and see if it logs anything
client.on('ready', () => {
console.log('Hello world!')
})```
nothing
start your bot and screenshot your terminal
so it is running. just not going onlien
yeah
you sure the token is correct and is corresponding to your bot?
are you sure its the token and not the client secret
^
Δ
it has to be capital?
i set const discord to lower case tho
its defined as lowercase
Im making a refactoring of my bot command handler and im wondering whats best when a user edit a command message (example: !ping)
- Delete previous command related bot messages and repost
- Edit previous command related bot messages
The second option seem more complicated because I have to abstract away the message posting and I essentially need to fetch existing reactions if any and delete them so
Does discord.py cache servers and users into memory or elsewhere?
I think mostly caches are in memory
how would i make a timed mute using sqlite? i could use setimeout but my bot doesnt run 24/7 without restarting
Save timestamp in db
On bot startup, check if user is in db, if they were supposed to be unmuted, unmute and delete record if needed
And run settimeout when command is used successfully and on bot startup
Play around with Date.now()
and save the value
then run an cron job that checks the db at specified interval
Who knows the jda and can help me fix my mistake?
how do most people handle huge amounts of help embed info?? my bot's help is getting really spammy but i dont have a site to refer them to
Pages
categorize your commands into more commands
either paginate the message or exclude descriptions from the commands list
@spare goblet maybe do a reaction system
I dont know why you said hehe on that ^ but ok
Lol my bot was declined for having no actual features..I figured it had quite a few
add more features perhaps
With 25 commands, I figured it was alright.
says actual functioning
They are. It handles quite a bit
Including account verification and linking, moderation, game information, etc
We'll see how it goes
i wonder why
idk why are saying that like you are assuming that we will copy paste your code, but why dont you try it first before asking here if something errors
how do I make something like owner id but admin
with multiple admins
do i do it like this or
Correct
If you want to be given an error for not having a comma sure 
Then you check if that array contains user ID
Yes
yes, you still need a comma in arrays
That's still an array
Yep
ok
thanks
how do I make so that a command checks if the user is in that array
if(message.author.id == config.json) {
code
}
its wrong
Load that json if it's in file and as I stated earlier, check if that array contains user ID
but how do I check
Google "json use keys"
no, if it's an array you need to check the full array, you're checking if an id equals an array. Also, I believe you can parse the JSON as you require it.
Oh
yes, if config.admins is the array.
ok
let uUser = message.mentions.users.first();
if(!uUser) uUser = message.author;
Profiles.findOne({
userID: uUser.id
}, async (err, user) => {
const profile = new Discord.RichEmbed()
.setAuthor(`${uUser.username}\'s profile:`, 'https://cdn.discordapp.com/emojis/396521773266632715.gif?v=1')
.setThumbnail(uUser.avatarURL)
.setDescription(`${user.bio}`)
.addField(` Rank` , `\`β ${user.rank} β\``, true)
.addField('Premium', `\`${user.premium}\``,true)
.addField(` Money` , `\`${user.money} Coins\``, true)
.addField(`Gold`, `\`${user.gold} Gold\``,true)
.addField('Badges' , `This user has no badges.`, true)
.setColor(config.color)
message.channel.send(profile)
})```
something wrong?
I am confused at why you're putting it in a template literal and not adding anything else
I'm confused what the problem actually is
in the database the bio is redutzu e zew
and it shows me None
the default
value
in schema
im getting crazy, do you know how i can control if in a input string there's any special characters? because i tried all the methods i imaged but nothing works, please help
you can try regex
i would like to do a special characters control for a battletag, so "#" is an exception
instead of making a blacklist of all the illegal characters, make a whitelist of all the allowed characters with regex
you don't need regex for that
how else would you do it then @inner jewel
an array of allowed characters
loop each character of the string
if not on the array, it's invalid
give me a minute
if message.content.startswith("!owrank"):
msg = message.content[1:]
await client.send_typing(message.channel)
s = 'asodgnasAIDID12313%*(@&(!$1231'
msg = re.sub('[^a-zA-Z\d. ]|( ){2,}','', s)
if msg == '' or os.path.splitext(msg)[0].isspace():
await client.send_message(message.channel, content = "Invalid Name!!!!!!")
else:
command = message.content.split(' ')
if (len(command) < 2):
embed = discord.Embed(title = "π Make sure you have typed the message in the right form!", color = 0xFF0000)
await client.send_message(message.channel, embed = embed)
elif (len(command) > 2):
embed = discord.Embed(title = "π Make sure you have typed the message in the right form!", color = 0xFF0000)
await client.send_message(message.channel, embed = embed)
else:
player = command[1]
for letter in player:
if letter == '#':
player = player.replace(letter, '-')
await client.send_typing(message.channel)
data = getInfo(player)
await client.send_message(message.channel, embed = printRank(data))
Hello. I'm new to all this bot stuff, i've never really touched code before. I was interested in learning how to code and program bots. Where could I start? Tutorials?
ive heard you use JavaScript
/[^A-Z1-9#]/gmi
that regex should be fine
You can use Python or JavaScript to start with
I strongly advice to learn the programming language itself and make some simple scripts first
@hasty dust javascript and python are the most popular beginner-friendly choices. i personally reccommend sololearn.com and w3schools.com for learning those languages. you should be experienced with the language before trying to make something as complicated as a discord bot
you can use almost any programming language, it comes down to preference
Well, to each their own 
yea, I undertand not going straight to bots, but my friend says to never use python for bots
which im kind of confused about
im using python 3, and i love it @hasty dust
Well, I can't say Python is bad for DIscord bots
I use it myself and it's pretty good
i personally wouldnt use python because of the different python and discord.py versions that exist, it can cause confusions
Not to be rude, but your friend probably doesn't know what "preferences" are :^)
@wide ruin said that so you can ask him
@mossy vine yep, that's one defect
he's online right now
That name is awfully familiar
lol
eggs hasnt done a lot of python or javascript at this point, so thats why i said js
but isnt it preference?
it is
Exactly
it doesnt matter what language you use, all libraries have 100% coverage of the discord api
JavaScript*
yea
Java and JavaScript are not the same
java and javascript are like ham and hamster, completely different things
im guessing they each have thier own pros and cons?
vegans only like one
Yeah
yep. but again, all comes down to preference
i mean if youve not done a lot of py, decorators and async can be a bit hard
so.. should I learn one and go to the other?
That's up to you, honestly
You could go with JS and later move to languages like C#
yea, I was planning originally with python, then going to C++ or something
The difference between them is significant
If you wanna go for C++ later, I suggest JS
ok
what are the c languages good for?
Later, way later down the road, I'd maybe be interested in.. AI?


