#development
1 messages ยท Page 382 of 1
oOf
oof
what do you need help with
dblapi!
do you have shards or not, if no, take out the shards posting and it should be good
const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('Your discordbots.org token');
client.on('ready', () => {
setInterval(() => {
dbl.postStats(client.guilds.size);
}, 1800000);
});
no
cant
why not
Nothing Happend When I Node .
you don't do node ., you do node ___.js 
caant too

๐ข
pls

NDIwOTIwNzQ5MzE0ODAxNjg0.DYG0qp-qrk
?
if thats a token then I suggest taking that out of there
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL(``, client);
client.on('ready', () => {
setInterval(() => {
dbl.postStats(client.guilds.size);
}, 1800000);
});
client.login("")```
??
only has one period so I'm guessing its either the 1st part of a token or the 1st and 2nd part
Yes. client.login("your discord token")
Anyways, if you dont know how to code, you should learn that
instead of coming and expecting to be spoonfed
dbl.postStats(client.guilds.size);??
oml
?
did you install the node module

You see, we have docs and very well-documented lib code on Github
๐ข
If you want to know what the function is, just look on Github
if you want to know how to use it in a more conventional manner, then read the docs
k
If you think there truly is a bug with the lib, however, it's best to go to #topgg-api
@clear hill https://github.com/DiscordBotList/dblapi.js
dblapi.js - An official module for interacting with the discordbots.org API
but only if you really think it's a bug, which it's 99% surely not
check docs before asking anymore questions about the library
Hey
``: treating /ping from #testing-1 as command
: State changed from up to crashed
: Process exited with status 1``
WHY?
public ProtocolType ProtocolType {
get {
return protocolType;
}
}
oops
Erlite - Today at 10:17 AM
because your code has a flaw
good luck finding it
there
when my bot muted i send /ping:
State changed from up to crashed Process exited with status 1
bot.on('message', function (msg) { if (msg.content.startsWith( config.prefix + 'ping')) { msg.channel.send(" pong!");
if your bot is muted, it most likely doesn't have permissions to speak in the channel so you can't fix that unless it is unmuted
so that is probably the error
and how to bot auto restart?
thats your own can of worms to do 
?
๐ฆ
Also may want to look into error handling + what is catch
fuc
yea with this
const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL(``, client);
client.on('ready', () => {
setInterval(() => {
dbl.postStats(client.guilds.size);
}, 1800000);
});
client.login("")
I have moved it out of my ready listener because everytime the stats got posted it would create another ready listener event, to reduce it I had to remove it out of any listeners and changed the setTimeout to client.setTimeout just letting y'all know that't how I fixed my possible memory leak warning with my ready listener
if you do const dbl = new DBL('token', client), you don't need to do the stats post inside the ready event I'm pretty sure
I don't use ^ that either, I just have 1 variables to let the bot know when it is finished logging in and ready to execute the rest of the listeners

not sure why would that create another ready listener 
ยฏ_(ใ)_/ยฏ
Idk I went through my listeners and from the array key #1 was the ready listener and key 2-42 was the stats event
when I moved it out of the ready listener it bumped down to 2 events the stats and the ready event
stats event?
the one that posts the stats to the DBL site
setInterval(() => { dbl.postStats(client.guilds.size); }, 1800000);
this one
ok so you use the Interval
that's an interval not an event 
you know what I mean, anyways it was listed 41 times under the bot's Ready Event in client.actions._events when I used my eval command to see why I had so many ready events
inb4 you did js setInterval(() => { client.on('ready', () => { dbl.postStats(client.guilds.size); }); }, 1800000);

no I would never do that I am not that much of a noob with making a bot to do something like that
well you must've did something wrong because the interval done correctly shouldn't create more ready events
it might have been something else in my ready listener but it's fixed after I moved it out, and this is before I fixed it.
wait why are you posting stats outside of the interval 
that snippet is how it looked in the ready event it isn't how I put it in my script.
@bright karma uhh yeah you posted stats outside of the interval
I doubt that was the issue though
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL(`Token`, client);
client.on('ready', () => {
setInterval(() => {
dbl.postStats(client.guilds.size);
}, 1800000);
});
client.login("Token!")```?
How To Host Bot?
rude
@languid dragon I have a question, how can I know if my bot has committed an infraction or an error due to not being able to enter the server? I tried to see the channel #mod-logs and I did not find anything about my bot. Thank you
did u search the bots id in the channel
look with the id and there is no mistake or something like in kick or mute
lol
;-;
node.js
hm
who can help me in node.js
ye
I'm pretty hard to learn
wat u mean?
who can help me in node.js
who can help me in node.js
@glossy saddle Someone will answer no need to spam
but
?
bamba?
tf you talking about ?
lol ?
Can you speak english ?
I don't think so l8
oof
well anyway stop spam this channel now
if(args[0] == null) {
event.getTextChannel().sendMessage("-fancytext <Text>").queue();;
}else{
int i = args.length;
String text = "";
for(String i2 = args[i]; i2 != null;) {
i--;
if(i == 0) {
i2 = null;
}
text = text + i2 + " ";
}
text.replace("a", "๐ธ");
text.replace("b", "๐น");
text.replace("c", "โ");
text.replace("d", "๐ป");
text.replace("e", "๐ผ");
text.replace("f", "๐ฝ");
text.replace("g", "๐พ");
text.replace("h", "โ");
text.replace("i", "๐");
text.replace("j", "๐");
text.replace("k", "๐");
text.replace("l", "๐");
text.replace("m", "๐");
text.replace("n", "โ");
text.replace("o", "๐");
text.replace("p", "โ");
text.replace("q", "โ");
text.replace("r", "โ");
text.replace("s", "๐");
text.replace("t", "๐");
text.replace("u", "๐");
text.replace("v", "๐");
text.replace("w", "๐");
text.replace("x", "๐");
text.replace("y", "๐");
text.replace("z", "โค");
event.getTextChannel().sendMessage("text").queue();;
where is the error?
I am not familiar with whatever language that is, but I am sure that there is a much simpler way to make every letter uppercase
i dont make it uppercase
oh
it make it fancy
nevermind
xD
๐ธ๐นโ๐ป๐ผ๐ฝ๐พโ๐๐๐๐๐โ๐โโโ๐๐๐๐๐๐๐โค
what even is the error?
does this make sense :
Traceback (most recent call last):
File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_hackrun/iiec_hackrun.py", line 29, in <module> start(fakepyfile,mainpyfile) File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_hackrun/iiec_hackrun.py", line 28, in start exec(open(mainpyfile).read(), __main__.__dict__) File "<string>", line 95 @bot.command() ^ IndentationError: unexpected unindent [Program finished]
it straight up makes zero sense because there is no reason there is something wrong, first, the indents are correct, and second, everything is written fine.
I lost my laptop
[JDA MainWS-ReadThread] ERROR net.dv8tion.jda.core.JDA - One of the EventListeners had an uncaught exception
java.lang.ArrayIndexOutOfBoundsException: 3
at Commands.cmdfancytext.action(cmdfancytext.java:26)
at Core.commandHandler.handleCommand(commandHandler.java:23)
at Listener.CommandListener.onMessageReceived(CommandListener.java:19)
at net.dv8tion.jda.core.hooks.ListenerAdapter.onEvent(ListenerAdapter.java:406)
at net.dv8tion.jda.core.hooks.InterfacedEventManager.handle(InterfacedEventManager.java:84)
at net.dv8tion.jda.core.handle.MessageCreateHandler.handleInternally(MessageCreateHandler.java:122)
at net.dv8tion.jda.core.handle.SocketHandler.handle(SocketHandler.java:37)
at net.dv8tion.jda.core.requests.WebSocketClient.handleEvent(WebSocketClient.java:990)
at net.dv8tion.jda.core.requests.WebSocketClient.onTextMessage(WebSocketClient.java:664)
at net.dv8tion.jda.core.requests.WebSocketClient.onBinaryMessage(WebSocketClient.java:1038)
at com.neovisionaries.ws.client.ListenerManager.callOnBinaryMessage(ListenerManager.java:368)
at com.neovisionaries.ws.client.ReadingThread.callOnBinaryMessage(ReadingThread.java:270)
at com.neovisionaries.ws.client.ReadingThread.handleBinaryFrame(ReadingThread.java:990)
at com.neovisionaries.ws.client.ReadingThread.handleFrame(ReadingThread.java:749)
at com.neovisionaries.ws.client.ReadingThread.main(ReadingThread.java:108)
at com.neovisionaries.ws.client.ReadingThread.runMain(ReadingThread.java:64)
at com.neovisionaries.ws.client.WebSocketThread.run(WebSocketThread.java:45)
@earnest phoenix
that is the discord api
ah
but
line 26 is the for section
But do you know how to fix
no
Love it xD
@onyx pebble How do you put a background image in the discord Client/webapp ?
I use a special modded Discord Client
BetterDiscord
working well ?

How do I auto erase my bot's latest message after x sec ?
With d.js just use message.delete
.py
but I think I found something
nope
sorry, I have no idea then
thank you anyway ๐
yep ^^
@onyx pebble. BetterDiscord is against the ToS and can result in acct termination
@frail harness I dont care
๐
@onyx pebble so you wouldn't care if I report kek
@old glade it's not author, it's message.author
Then I'll report you then lmao
I wanted to suggest a simmilar thing but dont have much experience with python
to include it into a var
Yes report me and waste your Time c:
Ok
I have a Backup Acc ๐
@frail harness u have sharex?
@frail harness BD isn't really strictly against tos, but selfbots are
modded clients are just not prefered, that doesn't mean it's not allowed under any circumstances
i'm setting how many users are using the bot using bot.users.size when the bot is ready but each time the bot resets it changes by a few numbers. am i doing it right?
include a library so that people know how to help
@ruby dust BD and modded clients are most definitely strictly against ToS
They released a statement saying that it is against tos now and can result in your account being removed 
@earnest phoenix 
i wonder
if you make an app that uses the API to literally behave like the discord client
would it be against the ToS
as it wouldn't be a modded client technically 
it'd count as a selfbot
oh guess that make sense
What is a self bot?
its like a bot but
its an user
you leak ur own accounts token and use it to send embeds or something like that.
@heady zinc i started doing that a long time ago before selfbots got banned
it was all command line based
noice
@dusty kettle should I
let allUsers = client.users.array();
allUsers.forEach(u => console.log(u.id));
```?
should do
oh great lol I always wondered what that was and what the "Works only for non-bot account" on api means
thats cool
Alright, I was really attempting to avoid this whole situation, but this is just what i gotta do to advance my bot further, I would like to create a toggle-able control that will add server id's to a variable, or something like that idk, but I have litterally no idea where to start...
What would you need this for?
I'm gonna be making it so it toggles a specific part of my bot for the server
it's a censor bot
Ah
Ik my code is really crappy, but that's besides the point
Do you have a database
nope
It might be useful
Basicly when a server admin presses the button, you'll want to put their guild in a list with guilds that have the setting enabled
And when he does it again it should be removed
yeah
I use redis myself, so you can look into smembers, sadd and srem for that
I was guessing like adding the server as the serverid variable.enabled and yada yada idk
You'll need a DB to store that info about the guilds though
Usually my DB is structured like guild:ID:setting_name: , true
sqlite can be a choice
sqlite is an option
there is plenty of dbs out there
So is Rethink, MySQL, PostgreSQL, Redis, Mongo
^
I use Redis, but be aware it is limited in the fact that you cannot search the DB
enmap
You need to know the key beforehand to get the value
enmap and enmap-level may be a good choice for beginners
Ye it's also local so you dont need a server
I'm not experienced with enmap but from what i've heard it's a good base
i have litterally no clue, what most of this is, but okie
but at some point you would need a real database
ah
google all of that
you're maybe even going to fall on tutorials 
google is much useful nowaways eh
I mean ik how to make a database technically, but, i don't really know how to use it...
Well if you know how to work with the d.js collections you know how to work with enmap. You only have to know how to set it up
Which is done in like 3 lines
seeeee, i'm not the best with js or d.js, so really i have no clue how to set, and retrieve data from a db
Search up a tutorial then
@slim heart Enmaps github is really clear, first you should learn what a map in javascript is though. When you know how those work you can look into how to create an enmap which again is super simple.
wait how exactly do i use this db locally since all of this is requiring like a host port username and password
which db are you using
sqlite is not a file
Well most DB's are hosted on a server which gives you access to it from wherever you want. But level-db based databases like enmap are stored locally.
as for sqlite you just have to launch it on localhost
it says SQLite Format 3 idk

๐ฎ
Nothing it's perfect
logchannel.send 
it's a channel in my discord serverf
@trim plinth logchannel is a var with a channel as value
mk
it's just a nice thing to have
Ye it's pretty clever
not really clever, its just searching for a id of a channel using a variable
or its looking for the name
i think he means the concept :>
i didnt do it the best
but like, you have a timestamp for everything instead of if you restart the console clears, atleast for me
@trim plinth it saves having to paste the id everywhere every time you want to log to his log channel
either way the concept isn't that advanced and/or clever
yeah thats just saving time not really clever
I mean, everyone has their own opinions but if you think thats clever then thats ok
right, i just need one bit of help, how do i connect to a local db...
@slim heart Well, have you chosen your db?
in terms of....
in terms of a database
^
cuz im just using sqlitebrowser and just made one lmao
sqlite lib
๐ฎ
probably
i mean i've made a .db file and like i can add fields and crap
.db file
google is your best friend
sql statements
i've used google
@slim heart But can nodejs communicate with that software you are using then?
what lang and which lib
discord.js
i mean, it doesnt have to use the software im pretty sure, if it's just a file then it should be readable by any mysql communication
a db isn't a file
mysql is db server software
i mean http://mlg-pro.life/sjwt20
no thats not how it works
why are you using a mysql lib for sqlite
idk what im doin
they are two completely different things

get an sqlite lib and follow their documentation
@slim heart use the sqlite lib, not the mysql one
okay...
alriiight, i see
okay i got all of that stuff running in my code, i think ๐ฎ
:/ i have no idea lmao, isn't there an easy way where i could like, make json files for each server, and then it would be like
{ "cursing": true }
there is but i wouldn't recommend making a file/server
i wouldn't recommend using JSON files at all tbh
is there a way to like when looking for a something like channel.sendMessage(file.variable)
but like, make it so that search for a var in the js file instead of "variable" so like,
const variable = actualvariable channel.sendMessage(file.variable)
but like it'll search for "actualvariable"
no
uuf
that'd add a huge level of unneeded complexity
okay ๐ฎ
umm, one question here: how can I shape an image to any shape in jimp?
example: you have a round circle, and you have a square picture.
transform the square picture to a round circle, so that you have a round circle picture.
Should always use canvas
Could be a bit of a pain yeah, but honestly it's so much better it's worth it
alright i've decided to use mysql cause i've already gotten it all set up etc. But now i need a way to call it, what i wanna do is test for if (based on serverid) if "censor" is true or false
and then () return; if it is false
so like something where i can do like, if(message.server.id IDK WHAT GOES HERE, censor=false) return;
One question
Did you read the mysql node.js module docs
@slim heart
It states it there
okay, well that really didnt help much at all unless SELECT is what you use to actually find it, cause i can't find anyway to actually find a entry in a row...
SELECT censored FROM Servers WHERE id = ?
it is based on the mysql commands
alright nvm, i did a mistake
i am able to pull variables from a row
etc
But idk how to set the specific result to a variable
@slim heart wdym
i got the return
but i want to turn "censor" into a variable that the rest of the js will acknowledge
i guess?
JS can't really interpret RowDataPackets
wait what would (therowobj) be?
I don't even know what database your using
alright well i can bump it down to just containing "censor"
cause i can do SELECT censor FROM etc...
im using mysql
convert to JSON
i've been told to stay away from json lmao
I think you've been told to stay away from json for databases, not code
^
LOL
And either way i still have no clue how to move it to json
But there should be away to define a result from
``connection.query('SELECT censor FROM censorbot WHERE serverid = ' + message.guild.id, function (error, results, fields) {
})``
nah just convert to JSON
something something callbacks or await
And i've tried googling it
easy way
Idk how to word it lmao
or @earnest phoenix's suggestion
what exactly do i google to use that suggestion ๐ฎ
google "node.js mysql access column from a row"
wrap your query statement into a function
call that function whenever you want to access a server's db data
i need a true or false result from "censor" when dealing with a row
im finding the row with serverid, then trying to retrieve 0 or 1 from censor
Somewhat related, but you should always use prepared statements, never concatenation in queries
well, i just figured out that sqlite and mysql are different things, i dont think im in any position on trying to do something more advanced ๐ฎ
It's very simple
connection.query('SELECT censor FROM censorbot WHERE serverid = ?', [message.guild.id], function (error, results, fields) {
//your code
})
that's what i have
but i need to be able to identify the value of censor
i can console.log it all i want and see it
but i need to see what it is in the code
You were doing 'SELECT censor FROM censorbot WHERE serverid = ' + message.guild.id
there is no troubles rn with []
Everything returns fine in console.log
like i showed before http://mlg-pro.life/yu8s8m
AYY
i just figured it out
that's an array
results[0].censor
The reason you should never concatenate is anything in that variable becomes part of the query. It may seem fine if it is the guild id where you know Discord will always give you a number but let's say you were getting user input and adding a swear word or something to your table like:
"INSERT INTO swears VALUES ('" + swearWord + "')"
Sure if swearWord was normal text, it would be fine. But say the user said their swear word is ';DROP TABLE swears-- it would add that to the query to yours and drop the table. But if you made a prepared statement like
"INSERT INTO swears VALUES (?)"
and used the whole bracket thing I mentioned, it would add that directly to the table, not executing it as part of the statement.
This can explain it better than my quick example: https://www.w3schools.com/sql/sql_injection.asp
There's no reason anyone should be using concatenation, even when you are 'sure' inputs will be safe, because you can never be sure and it is not a whole lot of work anyways to do it the correct way.
i've already figured everything out with what i had to do :>
But now i got another question ๐ฎ how would i avoid getting double entries of the same server, like, can i test for if it exists somehow?
UPSERT, you'll have to lookup how to do it in MySQL but the idea is to try to insert but on collision update. You can do it as a single statement.
(And still, don't concatenate.)
primary key for server id
I like Vultr for small bots
Well what solace said if you have some money to spend, but what fire.ajit.pai(please) if you are trying to host it for free. (imo)
Glitch.com Is Not Nice ๐ฆ
well my bot runs over glitch.com atm @clear hill
And you get a mentionable nickname
gl: {
a: ["guildleaders"],
d: {
desc: "Guild Leaderboard! One of the main bot functions.\n`[gl:r]` displays all the new guilds\n`[gl:a]` displays all active guilds(still making)\n`[gl:mem]` displays guilds with the most members\n`[gl:msq]` displays guilds with the most messages recorded by the bot.",
usage: "gl(:r, mem, msg, a)",
perms: "everyone",
},
f: (message, mess) => {
if(mess === "a") return message.reply("Still in production");
let l = "";
switch(mess){
case "r":
sql.all("SELECT * FROM guilds ORDER BY created")
.then(guilds => {
for(var i = 0; i < guilds.length; i ++) {
l += `[**${client.guilds.get(guilds[i].id).name}**](${guilds[i].invite === "" ? "" : guilds[i].invite})\n**Members:** ${client.guilds.get(guilds[i].id).memberCount}\n`;
}
console.log(l);
})
.catch(err => console.log(err));
break;
case "":
case "mem":
sql.all("SELECT * FROM guilds")
.then(guilds => {
guilds.sort(function(a,b) { return parseInt(b.points) - parseInt(a.points) });
for(var i = 0; i < guilds.length; i ++) {
l += `[**${client.guilds.get(guilds[i].id).name}**](${guilds[i].invite === "" ? "" : guilds[i].invite})\n**Members:** ${client.guilds.get(guilds[i].id).memberCount}\n`;
}
console.log(l);
})
.catch(err => console.log(err));
break;
default:
return message.reply("Not a valid leaderboard type");
}
embed.setAuthor("Everyone Bot Guild Leaderboard", client.user.avatarURL);
console.log(l);
embed.setDescription(l);
message.channel.send({embed}).catch(console.log);
},
t: 3,
del: false
},```
Whats wrong with that
anyone
...
;-;
Whatโs the error
I Have Money xD
Waiting Approved
@vale saffron the "Bot awaiting approval"?
Waiting Mods Approved
i can't wait
setTimeout(() => {
bot.user.setPresence({ game: { name: prefix+"Secret", type: 3 } });
}, 18000);``` Dint Works xD
oka
Help
i guess it will take some days for me
guys
What
I keep getting defined bugs
@clear hill 1. Random Presence Timeout
2. Setting Presence Twice
3. You can just put what you want as the Presence, nothing extra needed
irritates meh
Show error @timber tree
show code too ^
And the code where it happens
const title = info.title
^
TypeError: Cannot read property 'title' of undefined
info isn't defined / doesn't exist
info is undefined
if(args[1].startsWith('https')) {
voiceChannel.join()
.then(connection => {
let stream = YTDL(args.join(" "), {audioonly: true});
YTDL.getInfo(args.join(" "), function(err, info) {
const title = info.title
console.log(${message.author.tag}, Queued the song '${title}.')
var embed = new Discord.RichEmbed()
hmm
@timber tree probably err is not undefined/null if info is null so check err
You should always check if there is an error whenever the callback includes it
help
hmm what I do know is there is another bug included
how i can add badword? In My Bot Like !addbadword FUK FUCK Shit
(node:6476) UnhandledPromiseRejectionWarning: TypeError: dispatcher.on(...).catch is not a function
at voiceChannel.join.then.connection
no spoonfeed here
That's not the only way to catch an error
hmm
hey
well gonna try to dig more into these errors
how i can add badword? In My Bot Like !addbadword FUK FUCK Shit
how i can add badword? In My Bot Like !addbadword FUK FUCK Shit
no need to repeat it 3 times
how do i get my python bot to play the next queued song
@bot.command(pass_context=True)
async def play(ctx, url):
if playing = False
author = ctx.message.author
voice_channel = author.voice_channel
vc = await bot.join_voice_channel(voice_channel)
player = await vc.create_ytdl_player(url)
player.start()
playing = True
new_vid = queue[0]
else:
queue.append(url)```
const team = require("../files/team/team.json")
let team1 = args.slice(0,1).join(" ");
let teamk = team1.toLowerCase();
if(!teamk) return message.channel.send("You have to specify a member");
else {
message.channel.send(team[teamk]);
}
how do i make it find the right thing in the json file
like if i type xkijux it will find the "xkijux" in the jason file and output the info after as the message
@mental willow line 3 would throw a syntax error; it should be if not playing
also, you should be checking if the bot is already in VC
``Online: 2078
DND: 622
Idle: 614
Offline: 9159
Total: 12473``
^ How ^ Discord.js
figure it out yourself
?
why would u want to do that
u dont
^
someone teach me how to use
invite.uses in discord.js
docs
thx.
What's the best Cloud hosting for Discord bots that also need to stream music?
any VPS
Wait
Comprehensive list of hosting companies
Free
https://glitch.com/ - They can host node.js programs, needs some setup
https://heroku.com/ - They can host boats in almost any lang, needs some setup
Paid
https://www.ovh.com/ - Cheap servers, not very fast network, quite decent reliability
https://www.scaleway.com/ - Cheap servers, decent network, decent reliability
https://bakeryhosting.us/ - Cheap servers, no bandwidth limits, small company, decent reliability
https://www.vultr.com/ - Expensive, very good servers, excellent reliability
https://www.digitalocean.com/ - Expensive, extremely fast network, excellent reliability
https://vpsdime.com/ - Cheap, never have had experience with it
https://cloud.google.com/ - Expensive, scaleable, hosted by google, has free trial,
https://aws.amazon.com/ - Expensive, scaleable, hosted by amazon, has free trial
https://azure.microsoft.com/en-us/ - Expensive, scaleable, hosted by microsoft
thank you @gusty topaz
you're welcome
I use Aruba cloud rn but the bot is not performing well
so I'm looking for an alternative
that should be pinned tbh
^
would personally recommend vultr
good servers and great network
had no issues with them
but yeah they're expensive af
With googles service, making a ssh connection is like this
http://sharex.reinfernhout.xyz/i/tffr8.gif
i can't wait anymore to invite my bot -_-
sorry
@bitter sundial i can't wait anymore
web SSH clients are pretty trash, I would just use an actual SSH client
Google Cloud Trial is free for 12 months, with a 3GB 1vCore VPS
SSH keys won't do shit if you can just use a password to get into your VPS dashboard
Ah
they also have an Always-Free thing
free forever but specs are a little worse I think
No I dont think they have that,
Anyway cheapest thing is a quite shitty vps for 4 dollars/m
Next step is 15 dollars/m
Also this ssh client allows easy file upload and some other cool settings @uncut slate
what do u get in the 15/m
im not sure
So pretty neat
Vultr > Everything
@dusty kettle
ye
I have experience with VPSDime
@earnest phoenix Expensive
Very cheap and ran @cosmic shoal 24/7 for months
i use Galaxy Gate
@topaz fjord stuff
Havana runs VPSDime now
I'll check
and it had an uptime of almost a month straight
and only went offline due to a rethinkdb error
cloud.google is also nice because it handles all of my google api keys on the same dashboard
$10 for 2 core cpu, 4gb ram, 60gb space, 500mbps netowrk, and unlim bandwith
pretty sexy
That's good, but I use VPSDime bc its $7 for 4 cores, 6GB of RAM, good network speeds 200-300mbps down/up, and 2TB bandiwdth
wtf
and their servers are super reliable
1 year free with 300 bucks to spend btw
people told me vps dime has a shit tos is that true?
It's restrictive
They disallow targets of attacks
Like minecraft servers and gmod servers, things that are often targets of DOS/DDOS
lol
Look here
But still expensive
Premptive instances are cheaper, however, Google may shut them down if they need the resources
fortnite
language
(node:4488) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: No supported ALPN protocol was negotiated
Code:
const {body} = await snekfetch.get(`https://api.openweathermap.org/data/2.5/weather?zip=ZIP&appid=API_KEY`);
const Discord = require("discord.js");
const ms = require("ms");
exports.run = (client, message, args) => {
let tomute = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
if(!tomute) return message.reply("Couldn't find user.");
if(tomute.hasPermission("MANAGE_MESSAGES")) return message.reply("Can't mute them!");
let muterole = message.guild.roles.find(`name`, "muted");
//start of create role
if(!muterole){
try{
muterole = await message.guild.createRole({
name: "muted",
color: "123000",
permissions:[]
})
message.guild.channels.forEach(channel, id) => {
await channel.overwritePermissions(muterole, {
SEND_MESSAGES: false,
ADD_REACTIONS: false
});
});
}catch(e){
console.log(e.stack);
}
}
//end of create role
let mutetime = args[1];
if(!mutetime) return message.reply("You didn't specify a time!");
await(tomute.addRole(muterole.id));
message.reply(`<@${tomute.id}> has been muted for ${ms(ms(mutetime))}`);
setTimeout(function(){
tomute.removeRole(muterole.id);
message.channel.send(`<@${tomute.id}> has been unmuted!`);
}, ms(mutetime));
//end of module
}
this command to mutate for a certain time, right?
because when I was running it did not show the error, but it did not work
What's the error
when I run the command does not show, then turn off the bot on time
- Pretty sure await comes in a pair with async so itโd make sense to use async first before awaiting things
await()?
iirc thatโs not a function lol
This isn't bot development, but does anyone know what HTML code people use to make their bot icon look circular?
on the Discord Bots page
@jovial violet it's css
not sure if this would count as spoodfeeding
but i can give you the css
Thanks
I'm still learning HTML and I'm not thinking about learning CSS soon
I'm guessing animations are CSS too right?
border-radius: 150px !important;
}``` put this in a ``<style>`` tag
Because it's a part of the style
np
whats the selector for the bg?
@frail kestrel background-image
yes
import LinkedListNode from "./LinkedListNode";
export default class LinkedList<T> {
private head: LinkedListNode<T> | null = null;
private tail: LinkedListNode<T> | null = null;
private size: number = 0;
public add (item: T): boolean{
let temp = this.createNode(item);
temp.next = null;
if(this.head === null) {
this.head = temp;
this.tail = temp;
}
else {
this.tail.next = temp;
this.tail = temp;
}
this.size ++;
return true;
}
private createNode(item: T): LinkedListNode<T> {
return {
value: item,
next: null
}
}
public toArray(): T[] {
const array: T[] = [];
let current: LinkedListNode<T> | null = this.head;
while(current !== null) {
array.push(current.value);
current = current.next;
}
return array;
}
public display(): string {
return this.toArray().join('\t');
}
public length(): number {
return this.size;
}
}
what language is that 
TS
oh
that looks sexy af
ts looks way uglier than i thought
ngl
what you mean ugly
that looks bae
lol
that code is like 20x cleaner than plain JS
and actuall has typings + scales
@karmic parcel ```
}
else {
whats that
who does that

uh, meee obviously 
i mean thats kinda an opinion thing
just a coding habit that I picked up
yea
yeah
i
TS
I used to use C++/Java/Python heavily
ngl
and the OOP of TS just makes me moist
that way I can make a bucket a lot easier for rate limiting
tru
yeah making your own data structures is soooo much easier in TS
thats true but its actuall quite hard to make good typings for a large JS app
sometimes you get into some issues
because some stuff is other in TS
if you write it comletly in TS its neat ofc
yeah, doing it half and half is kinda reeee
same
that's why I'm gonna rewrite my webhook service in TS because I started to do a smol rewrite of the data structures and it was icky
uhhhh I work with Dank Memer, but I have my own bot called HawkBot
it's not on the list
mhmm
I haven't actually touched the bot code yet, I helped restructure and cluster the API server
and now I'm working on the website and dashboard
interesting
Is there a way to get a PrivateMessage if the PrivateChannel got closed and reopened(bot restart etc.) in jda
I tried saving the messageID, but throws a NullPointerException if I search the message with that ID
User#openPrivateChannel().queue(channel->doStuffWith(channel))
but with v6 they don't keep history anymore 
@inner jewel haha funny. Yeah I can open it but message still gone
so it's a guessing game of which
that's why you always call open
I just disregard DMs as reliable
JDA doesn't do any requests if the channel's ppen
so I don't fucke with them
open*
I want to edit a message. Works perfect until Bot restarts. Problem is that after the Bot restarts it cannot find that message anymore (Yes, the channel IS opened)
MessageChannel#editMessageById
also if it throws a NPE you gave a null argument to JDA
JDA never returns null
only on RestAction<Void>
or getting an entity not on cache
but in that case there's nothing nullable
In detail its no NPE but basically the same
net.dv8tion.jda.core.exceptions.ErrorResponseException: 10008: Unknown Message
Thats a Discord API error response tho
means that you try to edit an message what is not there or deleted already
Yeah thats what I know already, thats why my question was is there a way either to keep dms when restarting the bot or if there was another way to get written dms after restarting the bot
well then save message id in some kind of database => open DMChannel again => use editMessageById
that should work fine
Also check if id is null
Thats what I already tried
Rn bot does
Check if PrivateChannel is open -> Send Message -> Save MessageID to DB
And if it wants to edit this Message
Check if PrivateChannel is open -> Get MessageID out of DB -> Get Message by ID -> Edit Message
Bot even saves the PrivateChannelID. Everything works fine UNTIL Bot restarts.
Ur saying when bot restarts you cant edit?
Thats what I said 4 times already
Chill
Probably MessageID that ur saving is empty or not correct
Trying logging it
To see what u saved
I can see what I saved
what is your db
I am saving several things, but things that belong to the PrivateMessages are UserID, PrivateChannelID and PrivateMessageID
And thats everything you need to find the Message usually. You dont even need the userid
you do
channel.editMessageById(channel.sendMessage("a").complete().getIdLong(), "b").queue()``` this works perfectly fine for me
iterate through all users, checking discriminator
users.filter(_.getDiscriminator() == theOneYouWant).stuff()
How can I link a word to a url in the footer of an EmbedBuilder?
What lib?
JDA
Sad
You can't? I thought you could lol
I thought i have seen this aswell
I know you cant use markdown but thought there was another way
you can link the title (maybe author too, not sure on this one)
Can someone help me with this?
guild.channels.get(guild.id).message.channel.send({embed: {
^
TypeError: Cannot read property 'message' of undefined
you are trying to get channel with guild id
Probably because .message isn't a property? ๐ค
I have a question about the donate bot, is this where I can get an answer
channels.get(guild.id)
This donate bot
use an xml parser
that's not xml but just html 
xpath
for changing values
so when a person uses the command it will change to any updated values
@heady zinc html is xml
not exactly the same thing 
How would I cycle through a users roles and pull out the ones that were listed in a table I had made previously?
I'm working in discord.js
Any help is greatly appreciated. Tag me so I'll see the response.
How come I can't get the cards against humanity bot to work
Same any help would be greatly appreciated
@old phoenix wrong channel & ask in the support server
Okay
I feel like I'm putting too many shards, how many servers is it for each shard?
uhh..?
Shard count
I got 5 shards for each 1,000 server
is that too much?
How many shards should I need?
a shard every 200 servers is way too much
1,000 for each shard
1000 per shard is fine, but it depends on what your bot does
you can easily get away with 1800 per shard
My bot can't ๐
yeah, depends on what your bot does
It does a lot of automation work
But yes 1,000 per shard is actually a sweet spot
discord recommends 1500, my numbers are just community consensus
Probably with something official.
iirc 1k/shard is the officially recommended, but it depends on other things
oh gotcha
If you use the gateway endpoint to suggest shard counts, it goes by 1k
But starting at 500s, not 1ks
wait the gateway goes by a 1k?
yeah I didn't know it did either
Just do https://pls.amy.chat/r!.B9K.png
And use whatever number the gateway gives you
They can change it with / without warning - they have before - so just follow this because it'll be the most accurate recommendation for the most part
Doesn't explain how many. :/
Lmao I use 2 shards on a bot with 6 guilds
How do you think we all got our numbers?
What are you trying to get at
We used this endpoint
Rip RAM
And did the math
It's not that i don't believe ya, I just want documentation.
There is none
2 shards on a bot with 6 guilds..?
I remember it being 2500 then 1k afterwards.
First off that's not only pointless, second you probably won't even use more than 1 shard
Arguing about it here when there's no official docs on it is pointless
why have 2 shards for 6 guilds
memes
For the laffs
What documentation do you want
Just something official or close to it, like from discord or api languages.
for what was it exactly..?
There's no official "recommend X guilds / shard"
^
@floral stone https://discordapp.com/developers/docs/topics/gateway
Very bottom of this page
Someone told me about 2,500
2500 is the hard limit
But @uncut slate said 1,500
He was wrong
Hard limit?
That's recommended
^
He never said anything about max limit
2500 / shard is the max
Yeah, you should be following the gateway endpoint, which suggests 1000
You can get away with 1800 if your bot isn't intensive, like I said, depends on your bot
"2500 guild limit per shard (may be higher, but won't be lower)"
They may consider allowing more than 2500 guilds / shard right now
But atm 2500 is the limit
Beyond that there's really no docs
And you generally should just check what /gateway/bot says
Thanks!
Your library might have an auto parameter for shards, which also follows /gateway/bot (probably)
^
d.py has audosharding, but there is specify count.
Not sure if that is required.
It's not
how would I ignore commands from bots without spamming same peace of code in every single command definition? ๐ค
have a command handler
or just add the bot check in the beginning of your message handler
async def on_command(self, ctx):
if ctx.author.bot == True:
return
```this is what I have, and aparently this isn't enough
ah nvm, I'll do it tomorrow then, since it's 2 am already rip
I'm mainly doing this just to unmute my bot here tho ๐
I believe that if you're using the commands extension, it automatically already ignores bots
from discord.ext import commands?
well
you need that
but it takes a while to migrate
you can check out the extension docs here: https://discordpy.readthedocs.io/en/rewrite/ext/commands/commands.html
yeah well, I'll ask again tomorrow, in like 18 hours to be precise... and thanks I'll leave that opened in my browser
@ruby dust actually, on_command is run after the command is invoked
So you'll have to do it in on_message
the thing is that I have all events on a separate cog (file), and I'm currently using on_message event to filter invite links in servers that have that filter enabled
unless there is a way to have more than 1 of the same event
you can do both in the event
Like I do when someone mentions my bot he speaks?
are you wanting your bot to respond when mentioned?
yes
set the prefix to <@botid>
or
you can do this with d.py
not sure about others
make the prefix a list
and set it to ["<@botid>", "<@!botid>"]
thanks
i'm trying to link my discord.py bot to the discord bot list api but it returns this error: py Failed to post server count Forbidden: Forbidden (status code: 403): {"error":"Forbidden"} Traceback (most recent call last): File "/home/ubuntu/AppBot/dcdbotcog.py", line 25, in update_stats await self.dblpy.post_server_count() File "/usr/local/lib/python3.6/dist-packages/dbl/client.py", line 100, in post_server_count await self.http.post_server_count(self.bot_id, self.guild_count(), shard_count, shard_no) File "/usr/local/lib/python3.6/dist-packages/dbl/http.py", line 189, in post_server_count await self.request('POST', '{}/bots/{}/stats'.format(self.BASE, bot_id), json=payload) File "/usr/local/lib/python3.6/dist-packages/dbl/http.py", line 160, in request raise Forbidden(resp, data) dbl.errors.Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}
what's wrong?
pls tag me if u got a response
import dbl
import discord
from discord.ext import commands
import aiohttp
import asyncio
import logging
class DiscordBotsOrgAPI:
"""Handles interactions with the discordbots.org API"""
def __init__(self, bot):
self.bot = bot
self.token = '8===D'
self.dblpy = dbl.Client(self.bot, self.token)
self.bot.loop.create_task(self.update_stats())
async def update_stats(self):
"""This function runs every 30 minutes to automatically update your server count"""
while True:
logger.info('attempting to post server count')
try:
await self.dblpy.post_server_count()
logger.info('posted server count ({})'.format(len(self.bot.guilds)))
except Exception as e:
logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
await asyncio.sleep(1800)
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(DiscordBotsOrgAPI(bot))```
that's the entire cog
thats not yur token right? :p
lmao ofc not
and my main code has this: py startup_extensions = ["dcdbotcog"] if __name__ == "__main__": for extension in startup_extensions: try: bot.load_extension(extension) except Exception as e: exc = f'{type(e).__name__}: {e}' print(f'Failed to load extension {extension}\n{exc}')
verify your token aagin
if it still fails, regen a token
and the bot that's running all these is @slim moss right?
yep lol



actually it isn't