#development
1 messages Β· Page 441 of 1
but i want to change it. He needs to send the mentioned user a dm. I already searched for tutorials but no good answers
try looking at the documentation
and don't expect to be spoonfed
okay i would try
and yes you should look at the docs
I already read some docs
if you did you would know how to do that
please don't expect to be spoonfed, we aren't here to spoon-feed beginners
we're here to help beginners
and help them understand
ik, but reading docs about the topic of what you want to do (dm the user) will help you, and you don't have to remember all commands
just look at the docs
okay okay
didnt find this on the docs lol, how can I edit a category's perms?
cause categoryChannel.overwritePermissions is the same as guildChannel.overwritePermissions
thats discord.js btw
save_warn = 'UPDATE WarnLog SET = {} + 1 WHERE UserID = {}'.format(warn_count, member.id)
sqlite3.OperationalError: near "=": syntax error 
warn_count is equal to 2 
technically you are setting nothing
Turns out I was SELECTing only one column 
One message removed from a suspended account.
get a vps
One message removed from a suspended account.
read one of the pinned messages
the one by york
I keep getting this error, like constantly and idk what to do
Which means it keeps like receiving errors while trying to connect to the discord api but idk why
Are you with scaleway?
Whats that mean?
VPS hosting
Hmm
oof
@slim heart discord dyin
No but it happens like every day oof
well then maybe its on ur end
that means internet
No Discord is indeed broken
Embeds are not showing and i recently got internal server errors on my bots

Hey
how do you enable server count on the web page for your bot or is there certain requirements to enable it?
Add me
?
ah seen it in the docs now turtle thanks
are u sure
yes
lol
The error is telling you to use Channel.Send not Channel.SendMessage
Also you need to download the ffmpeg library
@runic cloud https://www.npmjs.com/package/js-ffmpeg
what
no
you dont need that
you only need ffmpeg in your path or global with a Enviroment Variable set in windows
You have already been told what to do
but I do not understand
Do not expect to be spoon-fed.
Yep
If you are a beginner, have a will to learn and do not expect to be spoon-fed.
Use a course if you want help, or go to a coding server l
@runic cloud
@runic cloud The error is telling you to use Channel.Send, not Channel.SendMessage.
And next time, read the error carefully before going help pls
Too true. I did that with my bot and everyone just told me to fuck off. I worked it out myself and learnt.
thats all anyone does π just post links and pretend they are elite programs and tell people to piss off
Wait... was it on this server?
@earnest phoenix
Nope
On repl.it
oh ok
DW I wassn't bannes
maybe they have different rules
it happens on this server just as often
Donβt spoon-feed or attack beginners.
They gave me a warning
attack beginners
Damm attcak is a strong word
ikr
and it was on this server
(the rule)
Wait I won't get banned for what I said ^^
i don't think so
Fewwwwwwww
I meant no harm
I was trying to encourage
in python, how would you allow ascii characters to be printed in the console? cause right now I get this instead:
UnicodeEncodeError: 'ascii' codec can't encode characters in position 116-123: ordinal not in range(128)
Try stack overflow or a forum maybe? I really don't know. Sorry
@ruby dust you are trying to decode with ascii utf letters
like Χ
which is impossible
send code
if it's JSON then I faced that
like json in python
it's not really my fault, I just log command executions in the console, probably a server name or a user name has unicode
probably because I convert every name and id as str()
oh yeah
use .encode() instead
what version?
of python?
3.6.4
oof I thought it was fixed in 3.x
because the default encoding in Python 3.x is utf
umm
you should do .encode('utf-8')
so I guess str(ctx.author.name).encode('utf-8') should work?
ok.
What with?
So basicly I am trying to add a bot.
ok
And it says bot not in discord.
This error
306949094608338944 is not in the Discord Bots server
And I was wondering what that means.
Or what do I do.
IDK. Does your bot work? Is all the info correct. Ping an admin maybe if this isn;t the case.
My bot works.
It is being used.
Clinet ID and ifo correct?
OK
Fair
IDK then
Yes it is right.
Ping an admin
Or a mod?
Or a website admin?
IDK, I am new
@fossil oxide Help me please.
Ok
I just tagged one.
Maybe a mod?
If he doesn't respond
What exactly is the problem?
^^ Look up
306949094608338944 is not in the Discord Bots server
if your bot is not in the server.. its not in the server
But where are you getting that message from?
Where are you getting that message from? π€
namespace AssistantJoe.Core.Commands
{
public class Ask : ModuleBase<SocketCommandContext>
{
[Command("ask")]
public async Task HelpAsync(SocketSystemMessage userMessage)
{
EmbedBuilder embed = new EmbedBuilder();
embed.WithTitle("You have asked a question to the staff members! This is your question:");
embed.WithDescription(userMessage + "\n \n" +
"*Your question has been sent to <>!*");
embed.WithFooter($"{DateTime.Now}");
embed.WithColor(Color.DarkBlue);
await ReplyAsync("", false, embed.Build());
}
}
}
``` What this is supposed to do is that you would type the command ``ask`` and after ask, you type whatever you want (eg hello!) and it will put it in the embed, but it gives me an error with "message not found" idk how to fix
you just need to get the message as 1 argument
HelpAsync([Remainder] String message) {
ok
remainder gets all the arguments as 1
k
if you needed like a severity argument, you could do (String severity, [Remainder]String message)
would allow them to .ask important this is my question
it gives me an error of the input text has too many parameters
can i see the code
namespace AssistantJoe.Core.Commands
{
public class Reply : ModuleBase<SocketCommandContext>
{
[RequireUserPermission(GuildPermission.Administrator)]
[Command("setup")]
public async Task HelpAsync(SocketGuildUser user, String severity, [Remainder]String message)
{
EmbedBuilder embed = new EmbedBuilder();
embed.WithTitle("You have replied to a question! Here is your answer to <@" + user.Id + ">'s question:");
embed.WithDescription(message + " \n \n" +
"*Your answer has been sent to <#" + ">!*");
embed.WithFooter($"{DateTime.Now}");
embed.WithColor(Color.DarkBlue);
await ReplyAsync("", false, embed.Build());
}
}
}
i left out what its using, do you need that as well
because youre asking for a guild user aswell?
thats in the setup command
{
public class Ask : ModuleBase<SocketCommandContext>
{
[Command("ask")]
public async Task HelpAsync(String severity, [Remainder]String message)
{
EmbedBuilder embed = new EmbedBuilder();
embed.WithTitle("You have asked a question to the staff members! This is your question:");
embed.WithDescription(message + "\n \n" +
"*Your question has been sent to <>!*");
embed.WithFooter($"{DateTime.Now}");
embed.WithColor(Color.DarkBlue);
await ReplyAsync("", false, embed.Build());
}
}
}
ill have to think about the setuo as well
you only need a minimum of 2 arguments passed by the user for that to work
i got it to work
you get too many parameters when someone types their ask message? and if you arent doing severity levels.. you dont need it.. thatwas just an example
i got rid of string severity
How would I create a leaderboard for this? ```
'USERID': {
'id':USERID,
'profile':{
'xp':0,
'level':5,
'coins':50
}
},
'UserID':{
'id':USERID,
'profile':{
'xp':50,
'level':20,
'coins':250
}
}```
try using embeds
im talking about putting them into the order
try comparing to see what is the biggest
but how could I do that with all the users?
idk
what language are you using
node.js
Well you're out of luck, try looking for someone else.
You can't sort an object in JS; you'd have to convert it to an array and sort that
Objects have no index, so there's really no order
is there an example for using webhooks to receive vote updates for python like there is in the README.md of dblapi.js?
but there is no example for vote updates with webhooks
I don't think the python lib can do that atm
just the server count thingy
isn't there a way to get vote updates with python without using the dbl python lib?
because python can do webhooks, I believe
and when your bot gets over a thousand upvotes per month you need to use webhooks anyways
well, gonna look into all of that
i've never really worked with web stuff in programming
Can't remember it fully but pretty sure it sends a post request - don't quote me - so if you listen for a post request to the path it will have the info
yeah, that's what I understood by just reading what DBL writes on that: DBL sends some kind of request to a specified URL and I just need to listen for it
if i got this correctly
Yeah
now i just need to work out how i listen for that in python and implement it in the bot
namespace AssistantJoe.Core.Commands
{
public class Reply : ModuleBase<SocketCommandContext>
{
[RequireUserPermission(GuildPermission.Administrator)]
[Command("setup")]
public async Task HelpAsync(SocketGuildUser user, String severity, [Remainder]String message)
{
EmbedBuilder embed = new EmbedBuilder();
embed.WithTitle("You have replied to a question! Here is your answer to <@" + user.Id + ">'s question:");
embed.WithDescription(message + " \n \n" +
"*Your answer has been sent to <#" + ">!*");
embed.WithFooter($"{DateTime.Now}");
embed.WithColor(Color.DarkBlue);
await ReplyAsync("", false, embed.Build());
}
}
}```
@mental solstice it's an embed builder
Does anyone know what region this server is in?
Us west
Okay. thank you.
has someone already implemented listening for upvotes in their discord.py bot using webhooks?
i'm kinda confused
i can't figure out how to listen for post requests
I know what it is @spring ember you arent required to use that method to pass it into the SendMessage method
So I'm a little frustrated currently. https://hastebin.com/judoqemuza.vbs When a user levels up I want to add a role but when I retrieve the role from my database, id of: 462357480824111123 it returns 462357480824111100.... i have no clue why. I'm not asking for a fix but does anyone know why I'm not getting the correct value even though 462357480824111100 isn't even in my database
I can retrieve values just fine in other tables but this one. I've tried a new table, different column names, different guilds, and nothing returns correctly
For the roles
.test is the column which stores the ID of the role.
when I message.channel.send(rowww.test); it sends the wrong value
Is the console.log showing the correct id?
nope
Ok. It shouldnt.. Just wondering
The value it logs and sends isn't even stored anywhere in my database so that's why I'm so confused.
Its stored in your db properly?
Yes.
I havent used JS very much.. but it looks right. Only thing i can think, is the type conversion is taking off the last 2 numbers then converting back long.. but its unlikely
Are you using VSCode by chance?
I am
Can you put a breakpoint at your sql.get statement and debug it
yah give me a bit
What language/library?
if (<message>.channel.type !== 'text') return;
Add that at the top of your message event, and replace <message> with whatever your message variable is (msg, m, message..)
in DMs? π
if (message.guild) {
let mod_role = message.guild.roles.find('name', settings.modrolename);
// add any guild-needing code here..
}
// other code..
Try that, that might work.
i was going to say that
if you want to check for dms, you just have to check if the guild property exist
if it doesn't, then it's a dm
uhh
Your setup confuses me to say the least, dunno why that isn't working..
Restrict owner commands to ID? >.>
And honestly, there are ways to get around it.
I'm having some issues with canvas.. I have this code:
const canvas = Canvas.createCanvas(700, 250);
const ctx = canvas.getContext('2d');
const background = await Canvas.loadImage('./background.png');
ctx.drawImage(background, 0, 0, canvas.width, canvas.height);
// avatar
ctx.beginPath();
ctx.arc(145, 125, 100, 0, Math.PI * 2, true);
ctx.closePath();
ctx.clip();
const { body: buffer } = await snekfetch.get(i.user.displayAvatarURL);
const avatar = await Canvas.loadImage(buffer);
ctx.drawImage(avatar, 45, 25, 200, 200);
// text
ctx.font = '55px sans-serif';
ctx.fillStyle = '#BE3EFA';
ctx.fillText(i.user.tag, canvas.width / 2.5, canvas.height / 1.8);
const welcome = new Attachment(canvas.toBuffer(), 'welcome-image.png');
client.channels.get('462311344558047232').send(`**${i.user.username}** has joined us! :wave:`, welcome);
However, when a user joins.. it only shows their avatar, no username/text; am I doing something wrong here?
Is tag the correct function for getting usernames?
π
Fixed now, turns out the image was taking too long so I put text before it.
Any Python libraries to work with images?
yeah @slender thistle pillow is one

when you need to use it its
from PIL import Image
img = Image.open("somefile.png")
# do stuff
π
so you could do
...
img = Image.open("triggeredface.png")
# do stuff```
Enough explaining, I will figure out the other stuff myself 
xd
Thanks, though @blazing star
np
Anyone here good with CSS? I need some help, but I'm not posting it publicly since its private thing π

ken
How do I make the bots icon float?
on my page?
Fortnite
#general or #memes-and-media @earnest phoenix
I mean how the hell do you even animate with html?
no one know how to animate bot icon on my bot page?
@earnest phoenix css in long description
has someone implemented listening for upvotes for their bot in discord.py using webhooks?
How do we send ping using a Photo like this bot does:
@river compass does
Developed by Ken#0027
you need an image manipulation lib
popular ones are canvas and jimp
i think canvas is simpler for that
with canvas yes
I m dumb i use canvas
the same way you would do in html5 canvas
Thnkz
I host on glitch currently and i wanna make a command that would update the code when i run command t!wha
The code:
const { Command } = require('klasa');const { exec, spawn } = require("child_process");module.exports = class extends Command { constructor(...args) { super(...args, { aliases: ['details', 'what'], description: 'Provides some information about this bot.' }); } async run(msg) { msg.channel.send("Updating..."); exec("git pull", async (error, stdout) => { // why are you in this file? xD if (stdout.toString().startsWith("Already")) { return msg.channel.send("Nothing changed since the last update."); } else { await msg.channel.send(`\`\`\`xl\n${stdout.toString()}\`\`\``); this.client.destroy(); spawn("node", ["index"], { cwd: process.cwd() }); } }); } };```
Or if the code isnt clear its here too https://github.com/bhangalepiyush/tuition-bot/blob/glitch/commands/System/update.js
π π
t
What is a good editor for editing on sftp? plz tag
how is sftp related to editors @onyx summit
also what programming language do you use?
node
I mean atm I have to do this:
Download the file I want to edit, open with editor, save it, upload it again
I know there are editors that do that itself
@spring ember
you probably mean ssh
writing code over SSH isn't exactly a good idea, the latency is going to be noticeable
ideal setup would be using git
create a repository (gitlab has infinite private repositories, github gives you one) and clone it on your VPS
I don't think github has private repos at all without a plan
well i use mobaxterm
which does what you want
it has an sftp window where you can browse remote files, double click them and they will download and open automatically in your editor
and be uploaded automatically on save
My bot can play music now
nearly any bot has that, but I still feel great about it
how is that development related 
Dunno
i have a music bot
@onyx summit They can't
node
I never programmed with python but with js so I prefer js
http://prntscr.com/k1akbm Im getting this error when trying to install quick.db
I get that with canvas like apparently it's something to do with guild tools being out of date maybe see of yours is updated
Build*
yeah
:/ I thought it was fixed but it wasnt
hello guys i'm beginner in JSON
how can i do to get all "names" of "username_history"
use
what language?
well its an object
just give him the array

javascript
<json>.username_history
will give you this
[
{
"name": "Roblox",
"changedToAt": 1463692529000
},
{
"name": "rObLoX",
"changedToAt": 1460501855000
},
{
"name": "roblox",
"changedToAt": 1457309480000
},
{
"name": "Roblox",
"changedToAt": 1453693653000
},
{
"name": "roblox",
"changedToAt": 1437522392000
},
{
"name": "Deprive",
"changedToAt": 1434807110000
},
{
"name": "deprive",
"changedToAt": 1430861254000
},
{
"name": "Candies",
"changedToAt": 1428269202000
},
{
"name": "Autocliq",
"changedToAt": 1425658817000
},
{
"name": "Sensual",
"changedToAt": 1423057400000
},
{
"name": "CrushedGrape"
}
]```
for(const entry of JSON.parse(...).username_history) {
doStuffWith(entry.name);
}```
or that
where the ... would be the string with that data
if never seen "of" used in an for statement

@earnest phoenix i just want
Roblox
rObLoX
roblox
Roblox
Deprive
deprive
Candies
Autocliq
Sensual
CrushedGrape
ah yes.. henry some mod's code is what you want
yeah
thank you natan
and thank you lose, you tried :v
i have this error
SyntaxError: Unexpected token h in JSON at position 0
what's the whole code?
const Discord = require("discord.js");
const got = require("got");
exports.run = async (client, message, args) => {
const res = await got(`https://mc-heads.net/minecraft/profile/${args}`, { json: true });
for(const entry of JSON.parse(`https://mc-heads.net/minecraft/profile/${args}`).username_history) {
message.channel.send(entry.name);
}
};```
you need to actually make the http request
JSON.parse needs json data
you're giving it an url
which is not valid json
k
Okay i made this
const Discord = require("discord.js");
const got = require("got");
exports.run = async (client, message, args) => {
const res = await got(`https://mc-heads.net/minecraft/profile/roblox`, { json: true });
for(const entry of res.body.username_history) {
message.channel.send(entry.name);
}
};```
is possible to get all names in one line?
user1, user2, user3
that's not how you'd use it
yes, that's incorrect
you want to use it on an array
entry.name is one of the entries
how?
res.body.username_history is the array
for(const entry of ARRAY) {
}```loops through the entries on it
so uhm, is there a way to efficiently detect invite links in messages?
regex
can you generate those easily? since ik that regex is really annoying to use
@grizzled totem what programming langauge?
or find the indexes of "discord.gg/" and "discord.gg/invite/" and see if they are -1 or not π€·
but yes, regexes are the best way
I don't know how
if i have images on a website that i use to pull from for an attachment how would I pull images that have names with hyphens?
you put the hyphen in the url?

um
you still put a hyphen in it?
I still don't see the issue
lol
there are multiple images in this directory as well
I don't see the issue either lmao
.setImage('http://gamercord.com/pokemonimages/all_gifs/'
no issues
so where would i put this hyphen at then?
whatever it's suppose be
would it make a difference
with apostrophe
yes bc it might break the string
see thats what I am saying you are asking me to put it in.. Im not trying to pull just one image.. this is a spawn command for a pokemon bot
yes that have a hyphen
welp
in addition to the ones i already have spawning
so, you want all the images, as long as they have a hyphen in their name
Because you were hoistering
what the hell is hoisting lol
there is a way to do it, but it's kinda messy
Using low value character like ! to bring you to the top
messy is ok as long as I can do it lol
ahhh ok i see what you are saying fishy because of the stuff in my name
enable directory listing for that folder, get the raw HTML by accessing it (just the folder, not any images), scrape the HTML for links, check to see if the filenames in the links have a hyphen, then use the links that do in your requests. You need to get each file one at a time
I'm not sure I explained that well
oof ok that is pretty messy lol but thank you
np
wtf is going on w/ my server count https://img.69420.me/wHd1df5p.png
shit literally skyrocketing π€
theres no way somebody is trying to dos my bot or something, right? π
inb4 ur graphs are backwards and ur just using mad CPU
π nah its accurate
i figured out i was on the front page cos the votes werent reset fully
somehow I was number 2 on front page lol
What bot is it
its not there anymore, just my music bot
can anyone recommend a server host?
Individual I think
If your server runs out of memory it might be a leak
How many guilds do you have?
@earnest phoenix
it only had 512mb
and im running apache on it aswell
and some other boths
but ill investigate if its a memory leak
apache 
apache is ok for php
True
php 
lul
Ok question, I'm using nodejs, and I'm wondering how I can eval multiple lines of script with out it crashing, how do I do that?
can't fully understand your question
if I defined a timeout of 60 seconds in bot.wait_for event, do I catch a discord.TimeoutError or just TimeoutError?
Declined
nvm it's neither of those
When I use multiple lines in scripts for eval the bot crashes, how do I prevent that?
@ruby dust yeah it's annoying af, I couldn't catch it but then I found out
just imagining that this takes less than 200 lines of code to generate is just π€€ https://cdn.discordapp.com/attachments/445205315286204416/463013105379704832/profile.jpg
yes, generate
you mean, without the background and profile images? xD
for real
that shit
takes only less than 200 lines of code
to process and send
and it takes from about 300 to 600ms
canvas has memory leaks btw
What does enabling rich presence on my bot do? I know what it does typically but im confused how it works with a bot?
bots can't have rich presence
when you enable it, you enable for the application
applications can have both rich presence and bots attached to them
okay.... So your application would be linked to a program/game? I still dont see how they are related.
https://discordapp.com/developers/applications/me
that page lists your applications
for all applications, you can create a bot user and enable rich presence
when you enable rich presence, you can create RP with icons from that application (even if you don't use any icons you need an application with RP enabled)
so oh so the code attached to the game is using the app as a connection to discord?
how to send an image with my bot? discord.js
message.channel.send("message", {files:[{attachment: image, name: 'name'}]})
@knotty steeple
ok
anyone here uses ovh?
I don't anymore but I have used it before for quite a while, what's up?
stupid question how can I tell if a mentioned user is a bot. (discord.js)...
let target = message.mentions.members.first();
if (target.bot) return message.channel.send("ERROR");
Above doesn't work. Am I doing something wrong?
Can someone help me?
k I'll try that nick.
That fixed it. Thanks!
ask their support server
-canvas
-memory
PICK ONE
oh
canvas 
@tidal parrot Jimp
blocking

i didnt mean blocking you, i meant Jimp is blocking in node.js
i know bro
just makin sure
Does anyone know if node-canvas supports jpeg?
I'm trying to edit a jpeg with it but it won't load
How i create a channel that just a user can see?
in discord4j, is it possible to know if the bot joins a guild for the first time? Im thinking about UserJoinEvent but i dont know how to check my bots user id. any thoughts?
GuildCreateEvent
Ahhh. So does this fire for every guild that the bot is in after connected to the gateway?
GuildCreate Event fires whenever the bot joins a new server
Hey folks, I was wondering where people actually host their bots, regardless of what language it's written in, are folks just spinning up VMs on random cloud providers?
@tiny dune
i set mine up on a vps
if you want to find some vps's there is a pin in this channel
ahh fantastic
Ahh ok thanks
Any chance you could tell me a bit about your deploy process? When you're ready to ship a new version of your bot do you just SSH in, pull down your code and run it?
Me I just SCP the code over from local and reload from the bot
Cool cool, you have a similar setup, just a random VPS?
Yeah
What color is it to make embed invisible?
#36393E
ah thanks
What's this?
tonymusicbot@ubuntu:~$ node polybot.js
events.js:188
throw err;
^
Error: Unhandled "error" event. ([object Object])
at Client.emit (events.js:186:19)
at WebSocketConnection.onError (/home/tonymusicbot/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:374:17)
at WebSocket.onError (/home/tonymusicbot/node_modules/ws/lib/event-target.js:128:16)
at emitOne (events.js:116:13)
at WebSocket.emit (events.js:211:7)
at WebSocket.finalize (/home/tonymusicbot/node_modules/ws/lib/websocket.js:185:12)
at ClientRequest._req.on (/home/tonymusicbot/node_modules/ws/lib/websocket.js:635:10)
at emitOne (events.js:116:13)
at ClientRequest.emit (events.js:211:7)
at TLSSocket.socketErrorListener (_http_client.js:387:9)
tonymusicbot@ubuntu:~$
(discord.js latest-stable, didn't make any changes to code, it just suddenly started doing this)
I had some WS issues too, maybe it's something with your server?
Dunno, my other bots are running on the same server perfectly.
I has some issues with that error when i has my βbadβ internet
first of all iβd recommend updating to master if it wouldnβt be too much work for you
and secondly have you got an event listener for client.on(βerrorβ...?
voice connections on stable are really janky
I don't have an error listener, should I add one?
And I know about that, going to be working on updating all my bots to master soon.
i think you should to see if that will catch the error
client.on('error', (err) => { log('error', err); });
something like that?
yeah that should work
(log is my custom function)
alright
wot, adding the error thing made it login
π

all good
master is constantly updated, consider it as a beta of discord.js
But it is a lot stable
My bot has been running for months in master with no issue

Master is better in a lot of aspects than 11.3 stable
nightlies or bust
me a css idiot so how does me make a button bend like this?
lol
@dusk thorn :L
@sick cloud you need to have like two divs overlayed onto each other and stuff
I tried that just then, its worked buut it makes the button stretch over the entire page
Wierd
and the text is also sidewards
put it into a third div and limit the size? π
Why not CTRL + U in Google Chrome. Search "Create a Server" and see how they did it.
Β―_(γ)_/Β―
Thats copying
uh
Nono
Hm
Why is it applying to the text too
is my question
I'm obviously not staring at the code, but that's strange
div.button.outline {
transform: skewX(-15deg);
padding: 10px 21px;
border: 2px solid #FFC302;
max-width: 220px;
text-align: center;
}
a.button.outline {
padding: 12px 23px;
background: transparent;
text-decoration: none;
color: #f2f2f2;
transform: skewX(-0deg);
}
<div class="button outline">
<a href="/" class="button outline">mc.polycraftia.net</a>
</div>
thats the code I'm using if it helps
Probably cause it's wrapped in the same Div class.
You don't need ShewX in a.button.outline
I tried that to make it reset lol
<command> "line here" "second line here"
(discord.js) 
Hello, How to create a role with permission in js ?
https://anidiotsguide_old.gitbooks.io/discord-js-bot-guide
oh thx
mongodb
for NoSQL Databases Rethink and Mongo are common but i would probaly use SQL anyways because consistency and speed
Postgres 
No mongo

I've just gotten so used to using postgres at this point
Ew
Mongo good
yes
@restive silo ayy since when do you use postgresql?
I'm using sqlite because it was convenient but I know I'm gonna regret it later
Depends on your necessity
And some things are just limited, like node for example not being able to handle 64bit integers (I totally do not have 4.3k reports of that in my bot because people have over 1b of currency)
im using flat json files :D

Hey I Created A Bot And How I Upload That Bot If Anyone Knows Dm Me
https://discordbots.org/ you can upload on their site
you have to wait for verification after upload
message.channel.send('@everyone') doesn't work even though the bot has enough perms... What shud i do?
lol wtf
and do message.channel.send("<@&idhere>")
server id?
Yep
no
everyone role ID is server ID
That way the mention doesn't work
no
<@&id>
yeah
<#id> is channel mention
well what's the server id of the place you're trying to ping
i did $eval message.channel.send("<@&326237705828564993>")
I got the same output 
and i get
@@everyone 
<@&id> doesn't mention
so what does?
a literal @ everyone
if the role is set to not mentionable in server settings, then it won't mention
In JS, there is a parameter disableEveryone, isn't there?
$eval message.channel.send(' @everyone', {disableEveryone: false}) boom it works!
thanks
How do I add a ban,kick, and warn system. I use Discord.js
<GuildMember>.ban()
no one here will spoonfeed you
I would rather just you send me the whole thing
lmao
Same with .kick
For warn system you need database
So if you don't know js just try and make kick and ban for now
What is the command in ubuntu used to view the latest log for a running service app
It's something with journal
just don't know thye parameters
journalctl -n amount -f -u service
where service is the name
and amount is the last n lines to show
-f means any new lines will be printed as well
wasn't there a way to see it live?
-f
How i get a list of channels
If you run a command that has incorrect args, and it reacts with an π emoji to your message, how do you make the bot show a message with the info if the user reacts?
i would personally tell the user they did the command wrong
but no it wouldnt count afaik
i'd have a listener (preferably a global one with a map of message id -> reaction handler) to listen for reactions on that message
if user adds that one you send the info message
Sounds pretty complicated, eek. alright though
does anyone know how to change bot's status type to watching in discord.py
if i'm sharding, should i open one database connection for each shard, or just one database connection across all shards?
One database connection means no concurrency for database queries. You need multiple connections if you're going to be querying a database a lot.
It's best to use connection pooling for that (either a global pool shared by all shards, or a separate connection pool for each shard) which keeps connections open allowing you to reuse them without opening a new connection every time.
But that depends on the time it takes for a query to execute
true but pooling removes that issue
removes/lightens
can still bottle neck its jsut harder
Not really, it just means you can support A LOT more
also you should take care when pooling with a high number of connections
if the DB has per-connection resources allocated
too many connections = memory wasted
i'd say i query the database at a medium level, i query the database if the user doesn't exist when i need it, and then cache that user
i am noticing a few deadlocks here and there however
What DB are you using?
@tidal parrot so sorry for the late reply i went out for a bit, im using postgres
Are there any good websites out there for bot documentation? (Apart from GitBook, I can't use it x.x)
What are you doing to get deadlocks on postgres with a single connection
Afaik postgres is row level locking
And even then with a single connection that's impossible
I think
i dont even really know
it happens about once every one or two hours, im not really sure what's causing it though
i do query the database on (nearly) every message event for the user's settings (for stuff like adding experience, adding currency, etc.) but i cache the user after doing that so im not sure why i'd be getting deadlocks
can bot token join server discord with invite link? :v
it should say that in every docs
an instant invite link is used by user accounts, an oauth link is used by bot accounts
how do I get the IntPtr of float[][] in C#?
more specifically, how do I get the pointer to an array of arrays
@spring ember Dude that's not really good to ask in a Discord bot server
Maybe in a c# server
Can someone give me ideas for my bot? I have the classics and some extras, but I don't know anymore
a. it's a development channel, b. I did in multiple servers
am I doing this wrong?
private static boolean updateStats(int payload) {
try {
URL url = new URL("https://discordbots.org/bots/461938818627665940/stats");
Map<String,Object> params = new LinkedHashMap<>();
params.put("server_count", String.valueOf(payload));
StringBuilder postData = new StringBuilder();
for (Map.Entry<String,Object> param : params.entrySet()) {
if (postData.length() != 0) postData.append('&');
postData.append(URLEncoder.encode(param.getKey(), "UTF-8"));
postData.append('=');
postData.append(URLEncoder.encode(String.valueOf(param.getValue()), "UTF-8"));
}
byte[] postDataBytes = postData.toString().getBytes("UTF-8");
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.setRequestProperty("Content-Length", String.valueOf(postDataBytes.length));
conn.setRequestProperty("Authorization", dblToken);
conn.setDoOutput(true);
conn.getOutputStream().write(postDataBytes);
Reader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
StringBuilder sb = new StringBuilder();
for (int c; (c = in.read()) >= 0;)
sb.append((char)c);
System.out.println(sb);
return true;
}
catch(Exception e) {System.out.println(e);}
return false;
}
it keeps throwing a 403 forbidden error
I feel like I'm not setting the auth header correctly
I'm doing the print stuff at the bottom so I can see the response
a decent on-topic answer
see, now two people replied
wishes bots can speak in this channel and runs !help
or you could wait for someone who knows how to help you
are you feeling annoyed?

Β―_(γ)_/Β―
Discord.js
Thanks
check docs first tho
before asking
How do I access a message's second mention with Discord.js?
I know you can access the first mention with msg.mentions.members.first()
I would say try .second() xd
But that is most likely wrong
.second is not a thing
xd knew it
@restive silo reworked docs ?!?!?!?
mine doesnt look like that
its my own custom css on the website
Different versions
no
@restive silo send
I use the master branch
@restive silo put it on stylish kthx
why didnt u tell me u weeb

Free website themes & skins created by the Stylish community on Userstyles.org
its not mine btw
but some friend of me made it for me

yea but this one is better imo
I don't visit the docs as much these days but I still use the default theme though
Hey... uhh.
I'm a newbie in these things of making bots.
I don't know how to put ban, mute, kick options to my bot
what language and library are you using?
Who know python bot development ?
@earnest phoenix look at member.ban() member.kick() for ban and kick
np
i'm really noob in this
Look
if (message.content == ',.ban') {
What do i put next?
@kindred epoch
const client = message.client
if (!message.member.hasPermission("BAN_MEMBERS")){
return message.reply("You don't have permissions to ban users.");
}
if (!message.mentions.users.first()) {
return message.reply("You need to mention a user first.");
}
const member = message.guild.member(message.mentions.users.first());
if (!member.bannable) {
return message.reply("I can't ban that user due to a lack of permission or invalid role hierarchy.");
}
member.ban().then(() => {
message.reply(`I banned ${member}`).then(msg => msg.delete(5000));
}).catch(err => {
message.reply("I was unable to ban that user.");
});
np
why are you giving code
@kindred epoch why you are using const member = message.guild.member(message.mentions.users.first()) when you can just do const member = message.mentions.members.first()? lol
Is it worth it to make a Website for the bot?
I can't get on my bot
@earnest phoenix walking or getting on your bot might hurt it, thats like me irl standing on you or something. don't be mean to your bot :(
seriously though, whats your issue? :p
No, nothing
π
π€
I don't know
Just write your bot in Go instead :^)
He wants to write in js.
@earnest phoenix you would want a JavaScript array
https://goo.gl/E0wYJp
JavaScript Arrays - W3Schools
from message.content
@night imp Thankyou!!!
Which you can get be splitting it seeing as it is a string
OH my god
I can't anymore
I have been all the goddamn day trying figuring out how tf i declare arguments
what do you mean with arguments?
@earnest phoenix in what language/library
Js
console.log('El bot esta listo');
const Discord = require('discord.js');
const bot = new Discord.Client();
bot.on('message' , (message) => {
if(message.content == ',.help') {
message.channel.sendMessage('***Commands:*** \n \n ,.avatar => Shows your profile picture \n \n ***Version: 1.0.0***');
}
if (message.content == ',.avatar') {
message.reply(message.author.avatarURL);
}
const content = message.content.split(" ").slice(1);
const args = content.join(" ");
if (message.content == ',.8ball') {
var rpts = ["SΓ", "No", "ΒΏPor quΓ©?", "Por favor", "Tal vez", "No sΓ©", "Definitivamente?", " Β‘Claro! "," SΓ "," No "," Por supuesto! "," Por supuesto que no "];
if (!args) return message.reply(`Escriba una pregunta.`);
message.channel.reply(message.member.user+' a su pregunta `'+args+'` mi respuesta es: `'+ rpts[Math.floor(Math.random() * rpts.length)]+'`');
}
});
bot.login('*')
As you can see that's an "8ball"
So when i put ,.8ball and the question. Nothing appears
When i type ,.8ball only. It says "Write a question"
your 8ball command wont get triggered if you write anything
if (message.content == ',.8ball') is only triggered if the content of the entire message is ,.8ball
if you write anything else, the message.content no longer passes that if
yes
idk if message.startsWith works, but message.content.startsWith
Thank a lot man
How do you delete something from a discord.js collection?
collection.delete(key) ?
what doesnt work?
Yo does anyone have a fix to (node) Error: connect ETIMEDOUT on Ubuntu?
Check internet connection
Its on a VPS
I can ping websites fine, but when I go to run the bot, it gives me that error
I'm pretty sure that it does not work with VPS
Using Vultr Cloud compute
Nope.
?
your first bet would be to get more information about the error itself
do you have a listener for the error event?
How to make a database in mysql like a queue
when i use a command it give me the next thing
Can someone please assist me in getting the bot to create an invite for a specific guild (discord.net c#).
rtfm
i did rtfm but all i found was a function to find invite details, not create one.
channels usually have some kind of invite create function right?
discord.js has textChannel#createInvite
I Want To Create Bot Which Talks With Users
what programming language would you like to use?
js
ok the easy one or hard way?
Both
what I mean by looking at pins
thats discord js
Yes
no discord js is easy for me because i am a noob
ok use that then.
thnx
Guys help plz! I have my bot on github, hosting heroku. But there is a problem in file index.js there is my token
reset your token then? @earnest phoenix
uhm
im not really into web development
but if i were to create a website for myself/bot
where'd i start lol
i know html and css but thats about it
actually it just needs text i can probably do it
if you have enough knowledge of html and css you can get a html/css theme off themeforest and edit its contents out / re-adjust it a bit (?) to fit your needs otherwise use a cms like wordpress or w/e with a theme
are this code this.bot.guilds.map not working anymore?
@earnest phoenix what lib?
@stiff juniper node js
yes but what library?
(discord.js, discord.io, discordie, eris, etc)
@earnest phoenix
@stiff juniper discord.js
get all guilds use the bot
message.channel.send(`Guild: ${guild.id}
Name: ${guild.name}
Owner: ${guild.owner.user.tag} (${guild.owner.id})
Default Channel: #${guild.defaultChannel.name} (${guild.defaultChannel.id})
Members: ${guild.members.size}
Humans: ${guild.members.filter(u => !u.user.bot).size} (${Math.floor(guild.members.filter(u => !u.user.bot).size / guild.members.size * 100)}%)
Bots: ${guild.members.filter(u => u.user.bot).size} (${Math.floor(guild.members.filter(u => u.user.bot).size / guild.members.size * 100)}%)`)
})```
A .forEach would be more appropriate than .map in this case.
btw
.forEach isn't shown in the docs but is defined in the Map class
np ππ»
@stiff juniper ok
.map is more for transforming lists like
var listOfUserNames = listOfUsers.map((user) => {
return user.username;
});
ok.getCharacters = function(user) {
var fameData = "ok";
var options = {
method: 'POST',
uri: 'https://nightfirec.at/realmeye-api/?player='+user,
body: {
some: 'data'
},
json: true // Automatically stringifies the body to JSON
};
rp(options)
.then(function (data) {
if(!data.player){
return 'Player not found';
}
fameData = 'Alive :fame:: **' + data.fame + '** | Account :fame::**' + data.account_fame + '**';
console.log(fameData)
return fameData;
})
.catch(function (err) {
// POST failed...
console.log(err)
});
return fameData
}``` How do i get it to return the correct fameData?
Oof I have an error with my bot
It's using discord.py
Now when I want to upload an image, it says "client not defined"
The funny thing is that I use client.command a lot, and it works
what do you mean you use client.command? @wintry bobcat
can you show us an example?
oh rip
if you are actually importing client (which you shouldn't) you should always import discord.ext.commands and from there add decorator @commands.command()
I do have did import discord.ext.commands, but I don't have the decorator
K thanks
you can get your client object from the ctx attribute ctx.bot
K
Sooooo, why doesn't this work?
client.on('guildCreate', async (guild) => {
await r.table('servers').insert({
id: msg.guild.id,
prefix: '>'
});
const logChannel = client.channels.get('461369688576753664');
logChannel.send(`I have joined **${guild.name}**! (now in ${client.guilds.size} servers) :tada:\nServer ID \`${guild.id}\`\nMembers/bots/total count \`${msg.guild.members.filter(u => u.user.bot !== true).size}:${msg.guild.members.filter(u => u.user.bot === true).size}:${msg.guild.memberCount}\`\nOwner \`${msg.guild.owner.user.tag}\` (ID \`${msg.guild.ownerID}\`)`)
client.user.setActivity(`over ${client.guilds.size} servers. >help`, { type: 3 });
});
It won't insert to the database, send to the channel or update the activity. Like it never fires.










