#development
1 messages · Page 651 of 1
Depends on the lib you're using tbh
Your bot connects to the API, So if you/your provided crashes then possible but not likely.
Some libs have internal error handling that reports to an event handler that you specify. They're mostly 404 errors though when the API dies
My bot is flat out not playing any sound when it is connected to a voice channel.
I am using this code: https://pastebin.com/LjEdhAqh
What do you mean by "lib"?
discord.js discord.net etc.
@warm marsh i just fixed that the red embed gets delteted atfer ;help
Why'd my name change? lmao.
because it's hard to ping you with that name
Oh Fair.
Okay, thanks.
It's a shame I can't really do anything about it but it's also relieving that it's not my fault.
it depends on your code and your library, most likely you can do something about it
the cases where you cant really do anything are very rare
@warm marsh I can set it to Dillon if you want
Sure.
Oh, that changes things.
I'm using Javascript, node.js, and Discord.js.
alright, are you catching your promises?
the leading cause of crashes in js are uncaught promises
@stray garnet it sends now? Or not?
@warm marsh Wait was that was in DM? or seever
I don't think I have a catch for everything.
I guess I'll just do that then.
I did it inside a guild. Then I got a dm saying Testing!
tf? @warm marsh it dont sends me anything
every promise that connects to the api, such as .send() has a chance to fail, and if it fails and there is no error handling, the error will climb up the process and make it crash
@warm marsh in dm
Hold on.
What are other common ones besides .send() that I may accidently neglect?
So checking a member's roles would count?
fetching, sending, setting, editing, changing, configuring, emojis, roles, etc
just checking them no, because it checks them from the user cache
but setting them yes
Ah, okay.
Anything that causes a visual or functional change in Discord then.
can anyone help me solve this problem?
start the bot without sharding and it might give you more information
i fixed it somehow
Bot puts "," to its messages as space
i just had to keep deleting the files and replacing them
@restive light pasting the relevant code would be helpful
'''client.channels.get("Loby").send(" " + arguments)'''
issue is in ("" + arguments)
What is arguments
oof a say cmd
it should be arguments.join(" ") instead of " " + arguments
The latter turns in an array into a string and adds it to a string
Which is why you get the commas
^
I just want to remove all ","
And that's how you do it
'''client.channels.get("Loby").send(arguments.join(" "))'''
will it work?
Yes
For example when i type !say good morning all
bot says: good,morning,all
try the code turtle sent
Wait @nocturne hazel
k
@earnest phoenix
@lofty lantern you want to add a bot to your server?
@mossy vine yess
@lofty lantern inv me to the server
@lofty lantern this is the wrong server dude
and give me the link
i will add it for you
i will add it @lofty lantern
invite me to it via dm
Talk in DM's already and leave this channel
oof
@bright mortar link server discord me?
@pale marsh how long does it generally take
Again, go to #memes-and-media or DM's
@bright mortar hello
DM
if(message.author.bot) return;
if(message.channel.type === "dm") return;
let server = message.guild.id;
if(!message.guild.me.hasPermission("MANAGE_MESSAGES")) return;
if(!db.get("citadelle").find({ serveur: server }).value()) {
let user = message.member;
message.delete(user);
user.send("**⚠ Ce serveur a activé le mode citadelle.**").catch(err => {
if(err) {
return
}
})
} else {
return
}
});```
When the citadelle system is active, why the bot doesn't delete any messages ?
i put this in async ?
🤔
I want the system to be activated and a user sends a message to any channel, its to delete it directly.
the argument of .delete() is a timeout, you're giving it a member object?
and idk what kind of value you're getting from your db, but the ! in the beginning means "NOT"
javascript question:
Why is my string targetId turning into an array
the white space is irrelevant code
the variable is being logged above the error as a correct string of numbers
concatenating a string and an array will force the array to stringify
but its still an array
if player.lastTarget strictly requires a string, it wont work
right, but why is targetId becoming an array?
where does targetId come from?
it exits a function as a string
console.log(tag + ' enters formatID');
if(!tag) return null;
if(tag.length > 1)
tag = tag[0];
var flakeID = tag.toString();
var flake = flakeID.match(/^\d+|\d+\b|\d+(?=\w)/g);
if(flakeID.length < 18) return null;
console.log('returning ' + flake.join(''));
return flake;
},
this is the function returning it as a string, the console logs work both in and out
hm
thank you
I just realized what I did
console.log('returning ' + flake.join(''));
return flake;
I wrote the join in the console
but not the return lol
happens to the best xD
I think I had that exact comment on match once too
// returns an array
strange that console wasn't logging it as an array
targetId = c.formatID(args); console.log('targetId in attack.js: ' + targetId);
was returning the "correct" value
instead of [' string ']
I can not get the bot Luca on my server!😐
Luca is a private bot
Why you want luca ?
what a shame
Oh 😂
I mean luca isn't impossible to rewrite on your own with a bit of knowledge
Please
It's pretty easy
First try what he can and then use.
My bot just copy the "case system" of luca idk if its what do you want
But i can guarantee copying code you don't understand will never get it to work
I have the Luca case system but it will be gone soon
i would like to have all the functions of luca
My bot is a copy of luca
It's pretty simple to make your bot exactly like luca
Most of Lucas features only work in this server
I also rewrote luca lmao
I wonder how many people actually have their own copy of it with their code
I mean mine is private and I havent seen anyone elses, but I also havent been on the dbl site in like 2 months 
did you also copy its amazing troll functions?
return message.reply('Aleyküm selam.');
}```
lul
Not that lol, just a rewrite of the actual luca in here
ok so basically how do i get the status of a client in djs (ready, disconnected, reconnecting) or is that shard specific
Each shard has its own status
Once the client is ready it fired the ready event
There are also events for disconnect and reconnecting
@valid frigate
ah so store this status in an object?
Can someone help? idk why im getting that error```ruby
#!/usr/bin/ruby
def triangle_num(n)
return (1..n).inject(:+)
end
def find_divisors(n)
return (1..n).select { |i| n % i == 0 }
end
i = 0
until find_divisors(triangle_num(i)).length > 500
i += 1
end
puts triangle_num(i)``````
012/012.rb:7:in find_divisors': bad value for range (ArgumentError) from 012/012.rb:11:in <main>'```
thanks for the reference tho, didn't notice lmao
I am making some music commands and I want the current time left of the song playing in the nowplaying command. I have access to the song's length in milliseconds. How would I go about this? Any tips or pointers in the right direction would be wonderful as I am a bit stumped.
convert it into minutes
That doesn't fix the problem, I can convert it into minutes but I want to be able to show the user how much time is left in the song
Save a timestamp of when the song starts playing?
Unless whatever you're using has some way to get the remaining time
how to run html from js file?
Well I save the timestamp but I'm stumped on what to do with it.
const songObj = {
song: song,
requester: message.author.id,
requestedTime: new Date()
}
I have this, the timestamp is the requestedTime and I can access the song's length in ms with song.info.length
I just need a push in the right direction what to do with this data
Bot doesn't found the member/role
thanks
@wheat jolt member uncached
wdym
what lang?
.setPresence({game: {name: `${bot.guilds.size} guilds}`,type: "WATCHING"},status: "idle"});
sorry
lol
@earnest phoenix bot.user
add it
bot = your-client
now i use setPresence
no
but it works
11.5.1
as i know
d.js
i didnt update it yet
yw
@dusky marsh You take the current time and subtract the start time, that's how long it's been playing.
You take the total time and subtract the time it's been playing, that's how long is left.
👀
You can also add the total time to the start time and then subtract the current time
It's just a math question rly 👀
yeh i just couldnt really get it through my head, you would think a college calculus kid would be able to think easier about it lmao, thank you
Discord.py
Command raised an exception: KeyError: 0
wait
for x in data:
print("lol1")
if int(x) == ctx.guild.id:
print("lol2")
if data[x][0]["ChannelId"]:
channel = self.bot.get_channel(data[x][0]['ChannelId'])
with open('data/moderation.json') as rfile:
data = json.load(rfile)
didnt send all code tho
this is one of the parts
def getjson():
with open('data/setmodlog.json') as rfile:
data = json.load(rfile)
return data
dont bully me for using json 😂
Does anyone know if it is possible to see what a user's status is(Not DND, etc) but like their game or whatever in D.JS?
@trail dagger Why u bully me 🤣
huh?
Its just a thing online, its a joke 😛
ok?
It's usually named activity
That wasnt the part that had any error Furuhashi
channel = self.bot.get_channel(data[x][0]['ChannelId'])
with open('data/moderation.json') as rfile:
data = json.load(rfile)
global case
try:
case = len(data[x])
except Exception:
case = 0
documented = False```
this had
why is discord f up my spaces?
Ok, what if they are streaming? Does user.presence.game.name just return null?
Not sure
What does data look like
It doesn't seem to me that data[x] in that iteration has any lists involved
Sigh
I should have figured that out for a long time ago when the error was
Command raised an exception: KeyError: 0
hello an anybody can give me the code to check if the message author is the owner of the guild where the message was send ?
lib: discord.js
Message.guild.owner??
I mean let's be thankful he gave us the lib at least lol
Hi all!!.
I want to implement a command in my Bot that erases all the messages that the Bot did without deleting the messages of other people.
If I use "await ctx.channel.purge (limit = limit)" all messages are deleted.
By the way I use Python
any idea?
For each message, filter the author to be the bot
but how?
@latent river read docs... it literally has what you are doing as a example

I got bored and just remade this lol (not using it for anything, just bored)
reason:LOL
ok
I just made a copy of it just because i was bored
is it possible to use discord rich presence only with http requests?
why did you send that image 
and alright
what do i exactly need then
docs are so confusing
/shrug, never worked with those. It's just my opinion on the HTTP requests. You might wanna take a look at SimplePresence source code
hello guys any one here ? i wanna ask for something
Sure, ask away
Oh ok
nice
i have another problem
let emoji = client.guilds.get("565270757102452756").emojis.find(r => r.name === "right");
and the error :
TypeError: Cannot read property 'emojis' of undefined
thats because the id is wrong ?
i mean the id of emoji "565270757102452756"
hello everyone ?
The guild isnt found, you also said your getting the id of an emoji
Your doing client.guilds.get, it needs a guild id
yea
i need to get the right ID
but i dont know how.. if you can help me.please help XD
You just copy the id of the guild 
On mobile it's here, on pc you right click and do copy id. You need developer mode on first tho
On mobile to enable dev mode its settings - behavior - developer mode
probably similar on pc
your settings are going to sync anyways with your phone
ah yeah
On iPhone it’s in settings>appearance>developer mode
True
Umm someone know how should i get a stats from a link?
if(msg.content.startsWith(prefix + "stats")) { const args = msg.content.split(" "); const name = args[1]; const url = "https://osu.ppy.sh/api/get_user" const key = osu; if(name) { let data = `${url}?u=${name}?k=${key}`; console.log(data); msg.reply(data); } else{ msg.reply("Username Not Found") } }
The command
[{"user_id":"PRIVATE","username":"Tedy No Joke","join_date":"2018-05-31 11:46:27","count300":"523402","count100":"105315","count50":"12770","playcount":"6741","ranked_score":"273415270","total_score":"1521917899","pp_rank":"255151","level":"61.3654","pp_raw":"1304.62","accuracy":"88.74329376220703","count_rank_ss":"3","count_rank_ssh":"2","count_rank_s":"39","count_rank_sh":"27","count_rank_a":"61","country":"RO","total_seconds_played":"277489","pp_country_rank":"1345","events":[]}]
and this looks if i acces it from browser
What's the exact issue here? That seems fine to me
Can you help me ?
https://cdn.discordapp.com/attachments/381889950666457088/597912499299287056/unknown.png
https://pastebin.com/KDewHG1D
( Discord Js)
@slender thistle i want to get the data
but i don't know how could i can get it
like `` let data = data.pp_raw; and to show the data
pp*
value
i want to get this "pp_raw":"1304.62"
but i don;t know how from a url
Use a package that sends HTTP requests and then send GET request to that URL, transform the response into JSON and you're good
As I'm not js dev, I have found axios that can help you (might be not the best)
oh
yeah i'll take a look at your sql error
me , or the other one?
Depends
You aren't sending any HTTP requests...
How
Did you read my previous messages
i did
If you don't know how to send HTTP requests, you should learn a bit more JS/NodeJS first
@earnest phoenix Getting stats - use jquery and jsdom to create a window and GET https request
A quicker an easier alternative is using the package request
jquery in node 🤔
yeah dont use jquery on node
It works if you use jsdom 
Warning tho request gets p messy if it's not json
oh
just use fetch :^)
@earnest phoenix https://www.npmjs.com/package/node-fetch
Also cheerio is pretty much just jquery in node tbh
or just use node's internal http modules
Anyone here know how to use SQL in java and wanna show me how?
I need to learn how to use a database so I can finish my web crawler I'm working on.
?
I have, the java docs for SQL are pretty shit bit I haven't looked at them in a few months and I've improved a lot so I'll look again but help is always apreciated.
Okays so I am using lavalink and I keep getting this error when I try and use the play command to play a song:
https://hatebin.com/bmrzqembfm
I don't understand what is causing it personally if anyone could please explain what the possible causes could be it'd be much appreciated
you're probably using an older version of lavalink
if you're using the newest one, either copyright or region restriction
@earnest phoenix Where can I get the latest version I though I downloaded the latest version
But the link I clicked brought me to an outdated version
Thank you @earnest phoenix
I'm using TypeORM and I'm getting this error:ts console.log(message.channel.guild.id); // logs the guild id const guild = await Guild.findOneOrFail({ select: [ "prefix" ], where: { id: message.channel.guild.id } });`````` 🚫 null value in column "id" violates not-null constraint
This is how the database looks like
How do I prevent my bot from going offline after an error?
catch and handle it properly
Also what's the error
Mainly permission errors
Ur bot shouldn't go offline for those
idk why it does
show ur code
How do u handle the error event
And that event would be emitted regardless of whether u include that code or not
``bot.on('error', error => {
console.log(error);
message.send("stuff")
});
message.send() isn't a thing
oh wait thats the old version
the new one is the same but message is channel
which is a variable
ok
Are u 100% sure the bot crashed for a discord permisison error and nothing else?
Yes
K
Anyone know a simple line i can add to restrict a command to nsfw?
I am trying to scrap a website but it doesn't bring up the websites info it brings up my internet page info, like the page it would pop up if the thing is inappropriate
But the website I am trying to scrape isnthat inappropriate
Well what wevsite is it, if it isnt too nsfw to share
Also
Not all websites allow that
A better approach
urban dictionary?
Would be to see if it had an api
It has a bunch of apis but none of them work
@lusty dew sounds like there some network block, is it running on your computer or a server?
or do what I am looking for
Computer
My internet restrictions are turned all off
I can go to the website myself
but when I try and scrape the website it brings up the restricted page info instead
Restricted page?
how are you scraping 🤔
if you're actually programatically scraping, unsafe warnings don't exist
I am using https://npmjs.org/package/request
its def something on your network
@amber fractal were both talking about restricting a command in the script itself right? Im new to discord.js so everythings confusing. Lmao
Request doesnt scrape does it?
Cause I can't remember how to use cheerio
@amber fractal what
Someone told me it did
In the discord.js server
@pastel spear restricting certain commands to only be used in nsfw marked channels is what I meant
I use request to make http calls to apis
Used to
Ah ok.
I just use node built in now
How would I use cheerio to scrape
they have examples on their readme
cause someone suggested it to me at first but I forgot how to use it
probably on the website too
you still need to use request or another request lib first
you can use cheerio to analyze the data you get from it
Yea I know
Fast, flexible, and lean implementation of core jQuery designed specifically for the server.
what's a good pastebin alternative with like no limits that i can send evaled text to?
(js)
@acoustic citrus hasteb.in, paste.bisoga.xyz, or one of the many other hastebin clones
its just hastebin but hosted by someone else
cuz hastebin is open source
and hastebin.com doesnt work anymore
ah i see
ngl
there are a ton of hastebin clones
haste.unbelievable.pizza, h.mayo.pw, file.properties/paste
but btw some of them expire after a while
aight thats cool
Hello
hi
did you write code for your bot
are you running your code?
you have to write, in your preferred language
and thats the wrong mindset
and run the code
please learn a programming language PROPERLY first
you learn whatever language you want
Website
Can I codeing bot in android
no
you didnt define files
send your code
ah youre just copying and pasting without understanding, nice
in the fs.readdir callback you declare the recieved files as file but refer to them as files
I don't see why everyone is using the file structure command layout
also you wrote lenght instead of length
Guess he copied code but wrote it himself
Everyone just copies each other
And added some mistakes 👀
basically
XD
in Discord.Client the option disableEveryone is false by default, no need to set it to false
Later today I'll publish my structure
typo is so annoying btw
Rip
😮 ik milky
I'm MickyBot
ill let him know
No milky
Did you understand that the code for that bot was stolen?
yes
milky is who it looks like its stolen from
if the bot is open source it isnt "stolen"
No it isn't
what are you trying to do?
@indigo geyser oof copy and paste
are you trying to scrape your own router's panel? if so, you just leaked all your devices mac addresses and names lol
Aarons-iPad Bigfoot MAXIMUSIII
@stray garnet yes
oof
@indigo geyser Whats the Owners Name?
@lusty dew your router may have an api
@quartz kindle No I'm trying to scrape another website but it scrapes my routers panel instead
whats the link you're scraping?
does it work on your browser?
what are you using to scrape it?
Request then cheerio
if you use only request, does it work?
Nope
Pc
js
how to make prefix none case sensetive?
I'm using my beta bot rn to test the command
two things you can try:
change your dns to google/cloudflare dns
the website might be checking browser presence, such as referral or requested-by headers, so you'd need to figure them out and emulate them
Hm I'll try
Later
It's late asf rn
And I'm working on another project lmao
So many projects at once
@latent oasis when you check the prefix, convert everything to lower case or upper case, so that everything is equal-cased
i tried to lower case and it just work with lower (not working without upper case)
Which if anyone wants to help me with this project dm me please help is much needed for this important project
you need to convert both sides
the thing you're comparing, and the thing you want to compare to
no need for both
hmm
just pick one and do it to both sides
prefix.toLowerCase() === message.toLowerCase()
or message.toLowerCase().startsWith(prefix.toLowerCase())
or whatever system you're using
var prefix = config.prefix //Default prefix
let fetched = await db.fetch(`prefix_${message.guild.id}`);
if (fetched === null) prefix = config.prefix
else prefix = fetched
if (message.content.indexOf(prefix) !== 0) return;
i cant understand how to make it in my part
Making a rpg game, so for item details should I save them making class object or just fetch the details of item from database, which one will be more efficient? using sql3 database and python 3.7
@latent oasis you have message.content, and you try to see if prefix exists in it
oh
so make the message content lower case, then try to see if a lower case prefix exists in it
@gritty pike if those details will never change, it is safe to hardcode them
but if you think you will ever change/balance them in the future, put them in the database
ohk, understood
hmm
const args = message.content.slice(prefix.length).split(/ +/);
would it be a lot of uphill work to change that into a class?
command.execute(player, message, args);
so that it passes a "Class of arguments" with properties for data validating etc
rather than every "file.js" having validating of a string array
How to that?
example
User: @sterile zinc
Bot: My Prefix is ;
it shouldnt be much work, you can make a class, or simply a function that returns the checked and formatted args
I was thinking the class route for readability, but then I'd have to require the definition in every file right?
you can make that operation in the main file, before passing it to other files
Ah I think you just answered it
"passing a class" keeps the definition
case "rss":
if(!args[2] || !args[3] || !args[4] || !args[5]) return c.reply(message,'\`Invalid quantities. Be sure to include all 4 resources. (wood, stone, gold, trophy)\`');
target.rsWood += +args[2];
target.rsStone += +args[3];
target.rsGold += +args[4];
target.rsTrophy += +args[5];
replyStr = `\`${target.name} gains ${args[2]} wood! ${args[3]} stone! ${args[4]} gold! ${args[5]} trophies!\``;
break;
ew
thats the type of stuff thats starting to get on my nerves
if anyone else reads it they are like "wtf is all this"
looks like a normal switch case to me
yeah, the switch is fine
its just the persistant use of "args[ ]" and "args" throughout the code
if you recall my small dilemma yesterday about array type
you can do the validation before the switch
if you know for sure everything is valid, then you dont need to check for validation during the switch
you can have a "prepare/validate" function to validate the args
I guess the better argument I need to make is that the "args" array contains different data types
strings/integers
for example I use this command line in just about every file:
var targetId = (args=="")?message.author.id:c.formatID(args);
you can either include different validations for different commands in the validation step, or you can do a general validation, such as checking for undefined/null, and then inside the switch you check for typing
where the function has to format the first element of the array
and the null check is checking for no input
it's really just a question of readability
var repeat = args[1];
var cmd = args[0].toString().toLowerCase();
that's what I did in a few files
but I'd prefer to keep every file using the same variables
every command will have special handling to some degree
iiii.iiii
I see
Question time.
I have a empty global Array []. The data is pushed to it in a function.
Now I wan't to return the Array with the (pushed) data outside the function, but it says the array is empty 
Any idea?
var testArray = []
//Fetch all planned work-activities
const endpoint = 'https://ns-api.nl/reisinfo/api/v2/disruptions'
fetch(endpoint, {
}).then(function (response) {
return response.json();
}).then(function (nsjson) {
let payloads = nsjson.payload
for (i in payloads) {
let payload = payloads[i]
let type = payload.type
if (type == "werkzaamheid") {
let title = payload.titel
let gevolg = payload.verstoring.gevolg
let periode = payload.verstoring.periode
testArray.push("title + gevolg + periode")
}
}
}).catch(function (response) {
console.error("Oops, something went wrong.")
})
console.log(testArray)

returns empty
what lib
Js
get the guildMember object
Only members have roles, so get the member object
How to get it?
Multiple ways to get it
Since you don't want to use the message object, you can use the guild object
so, I am looking to add someone to an role when he adds an reaction
So when I got the "user"
Then you can get the member object from the event
Oh.
So change user for member?
Then member.addRole(bot.roles.get)?
How yo get the role?
You can do <Guild>.roles.get(id) or <Guild>.roles.find('name', 'your role name')
Hi
My bot was on for 1 month and without any change it is showing err can't find module discord.js
What u mean
its just processing past the return;
Are you installing it to the right directory
what return is it skipping
var testArray = []
fetch('https://ns-api.nl/reisinfo/api/v2/disruptions', {
headers: {
'Content-Type': 'application/json',
'x-api-key': key
},
})
.then(res => res.json())
.then(json => {
let payloads = json.payload
for (i in payloads) {
let payload = payloads[i]
let type = payload.type
if (type == "werkzaamheid") {
let title = payload.titel
let gevolg = payload.verstoring.gevolg
let periode = payload.verstoring.periode
testArray.push(title + gevolg + periode)
}
}
});
console.log(testArray)
testArray still empty? It works fine when placed straight under the push. 
Anyone any idea
Yes
Because the piece of code inside your .then() is async
The rest of your code continues to run while that bit is waiting for the fetch to finish
makes sense, but then how to solve it.
I've now a work-around with writing the data away to a json file, but you'll always parse the previous file when running the command
magic
do you know a programming language?
...
maybe its not for you then lol
If you don't enjoy programming a bot just use someone elses
Well is there a bot that can make messages like this command here
*messages
like what
I'm sure there are a bunch of bots with custom silly commands
I think MEE6 does that
bots have a gender 👀
btw
disregard my problem
I am a neanderthal
apparently if you call a function twice it doesn't behave like you called it once
imagine that
especially with different variables
commands?
Yea
like the discord API?
Think so and help commands as well
that has all the objects/properties of discordjs
So I can put it in my bot command tools
stick to general chat I think you have a general problem 😉

There seem to be a lot of people who show up here not knowing a bot requires programming
yes
Yep
#502193464054644737 it's at the top @near igloo
Can I change the bots pfp through the api
I dont think you can anymore
OK thx
how can i send a message to everyone in a guild? js
thats illegal
i just want to know how
fetch all members and send them messages in a loop, but that will possibly get you banned
people r already doing that in their guilds, i keep getting messages by a bot every hour
the fact that other people are doing it doesnt make it any less bad
you can always report those bots
"oh yeah, some people are murdering people, that must mean i can do it as well"
Can someone please help me on how I can get image data from the reddit api using superagent?
Using the reddit api's random.json feature?
heroku is shit
^
All free hosts are bad
Yeah
I thought we already answered your question... get a proper VPS
Hi
Please stop sending the same message in every channel
Especially #development or #topgg-api
@earnest phoenix make a command variable e.g. const command = args.shift().toLocaleLowerCase(); below your args variable. Then when creating a command do if (command == prefix+'command') {}
No worries.
the locale in .toLocaleLowerCase() doesn't really matter... the locale part is only useful when using JavaScript in the browser, not with node. String.toLowerCase() would do just fine.
Yeah I know, I've just used that so long that it's just what I type.
Yeah
Ok, have fun. Any questions about developing ask here.
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to github.com [140.82.114.4] port 22.
debug1: Connection established.
debug1: identity file /home/antonio/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/antonio/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/antonio/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/antonio/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/antonio/.ssh/id_ecdsa type -1
debug1: identity file /home/antonio/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/antonio/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/antonio/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.8
debug1: Remote protocol version 2.0, remote software version babeld-93408c70
debug1: no match: babeld-93408c70
debug1: Authenticating to github.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /home/antonio/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,rsa-sha2-512,rsa-sha2-256,ssh-dss>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey```
I'm getting this output when running ssh -vT git@github.com.
I'm trying to setup github ssh login if that helps. Here's the rest of it: debug1: Offering RSA public key: /home/antonio/.ssh/id_rsa debug1: Authentications that can continue: publickey debug1: Trying private key: /home/antonio/.ssh/id_dsa debug1: Trying private key: /home/antonio/.ssh/id_ecdsa debug1: Trying private key: /home/antonio/.ssh/id_ed25519 debug1: No more authentication methods to try. Permission denied (publickey).
The files located in /home/antonio/.ssh/
It's added.
It's fixed, hopefully.
I'm trying to get my bot online, but nothing's working. (I'm using Visual Studio, Node, and TypeScript, so I'm running it on a json Script).
console.log("Bot Online");
})
client.login(ConfigFile.config.token)```
The only thing it's giving me in the console is
``SyntaxError: Unexpected token *
at new Script (vm.js:80:7)
at createScript (vm.js:264:10)
at Object.runInThisContext (vm.js:316:10)
at Module._compile (internal/modules/cjs/loader.js:670:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:718:10)
at Module.load (internal/modules/cjs/loader.js:605:32)
at tryModuleLoad (internal/modules/cjs/loader.js:544:12)
at Function.Module._load (internal/modules/cjs/loader.js:536:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:760:12)``
And I just don't know how to fix Syntax Errors.
you have an unnecessary * somewhere. in the code
Checking now
Can't find one
I only have 4 Asteriks, and removing them logs them into the Problem Output
send your whole code with sensitive data removed, and if its too big just put it on pastebin or smth
Kk
{ Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'neilcorp_admin'@'ip' (using password: YES)
what is this ?
mysql error
everything is good, the password the db and the host
well it likely isnt
im not familiar with mysql, but maybe theres output on the server side?
oh i see whats happening
ts compiles your code into a syntax that your node doesnt understand
Hec
I got it online before
(Using a different bot application)
So should I try to get the new node?
or compile to an older js syntax
I don't think I know how, it's been a while lol- specifically...last year october
So just run that in the terminal?
run what?
you can do it from your terminal if you have a tsc command already for compiling it
what do you run to compile it
The TypeScript site says the compile command is "tsc helloworld.ts"
oh
theres a cli option/argument for specifying what syntax/version it should compile to
read docs, i forgot lol
i think I should redo the code idk
or not
Im completely puzzled on what to do at this point
i told you what to do
i just forgot what the option is called
a quick google search should help you tho
Kk
What do I search though im an idiot lmao
Im literally thinking about going on y ou t u be
typescript compile to es6
the search results will likely direct you to a compiler option, read docs on that option
no, you want to compile to an older version of js
you could also update to node 12, but afaik that breaks some modules

Im on a family comp, and my dads the admin lol
I do
oh
well then just wait
If I can't get node 12 im probably just gonna weep and eat eggs then delete my code and start over
if you dont have to use ts, you could just use js
try tsc file.js --target ES5
oh its target
although the docs say the default is ES3, i dont see why node wouldnt be compatible with that
Trying
error TS6054: File 'file.js' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
Found 1 error.
Im legitimately confused
You must compile your TypeScript to JavaScript before being able to run it. You'll want to create a ts config file. Then use tsc -w or the file you want. Then run as node.
What does this mean?
- parse error: Expected another key-value pair at line 20, column 3
Discord.js
Ping with response please
tsconfig.json - The settings I used when using TypeScript.
{
"compilerOptions": {
"outDir": "dist",
"module": "commonjs",
"inlineSourceMap": true,
"target": "es6",
"strictNullChecks": true,
"strict": true,
"skipLibCheck": true,
"noImplicitThis": true
},
"exclude": [
"node_modules"
],
"compileOnSave": true
}```
I used tsc -w in the console
and then created a folder called dist
where the compile code went.
change target to something else
Me or him?
you
Alright
one sec
https://pastebin.com/A5r4a35F - Compiled JavaScript
https://pastebin.com/rrJHPz19 - Not Compiled TypeScript
That's one of my olds bots so the code is a bit meh.
node sharding.js
@mossy vine Wow, I can't believe I missed that 🤦 Thank you!
and whats the error youre getting again?
I'm not getting any?
I was telling the guy that's getting the error how I did mines.
Lmao.
oml im so stupid
Lol
my only excuse is that its 1:30am tyvm
Fair.
@modern sable i think your site has done an oof https://oh-mah.ga/qzitJSa5.png
servers diff makes sense but shard are um...
lol
been running 2 shards for ~a year now
But when did you start uploading shards
ages ago
its not recent put it that way
can confirm lol https://oh-mah.ga/blNFIe3H.png
oh hey thats just over a year
wait nvm... for a sec i thought marco's site was open source
yeah thats my commit
cool
Is this well defined?
rollbar: new (require('rollbar'))(process.env.ROLLBAR_ACCESS_TOKEN),```
3|PentaHub | TypeError: Cannot read property 'minimumLevel' of undefined
Discord.js
How do I get a users last message using their ID?
I want to get their last message from the server the command is run in as well as any server the bot is in with that user.
I've tried all that I can think of...
Ping with response, please
Yes, I have
message.channel.send(message.author.lastMessage)
```This works, but only for the author...
You'd fetch the member you need
Oh, wait! Yay, I got it!
Well, for the current server
Gotta figure out the global one 
Then fetch the guild then the member
Mhm
The only problem is, I want it to get the last message from any guild that both the bot and the user are in.
So I don't have a guild ID...
Well you cant get messages from a user that the bot isnt in
Not only would that be a violation of tos, it's literally not possible
Edit: read that wrong lol, thought you were talking about unshared servers
I know, but from a server they're both in
Well what do you need it for
For a userInfo command ¯_(ツ)_/¯

Why would you need their latest message from any other guild than the one the command is used in tho
You would have to loop over every guild and see if the user is in it. Im not sure if it's allowed by tos to share their last message from other servers tho 
Eh, that's too much work 😂
I guess I won't do it. Thanks for the help though!
Discord.js
Isn't there a way to use a code block in an embed without doing MESSAGE?
I Googled but found nothing...
Hmm
For the life of me i cant figure out how to restrict a command like this to nsfw channels. Am i just dumb or is it alot harder in discord.jsif(command === "kiss") { console.log(${message.author.tag} used the kiss command); message.delete().catch(O_o=>{}); if(message.mentions.members.size == 1) { let member = message.mentions.members.first() message.channel.send(${message.author} kissed ${member}!, { file: "https://media3.giphy.com/media/G3va31oEEnIkM/giphy.gif" }); }
Alot of my commands for sending images are based on this same code.
uhh
if (!message.channel.nsfw) return message.channel.send('Has explicit content.');
ah
Ima make a release for async that includes most rewrite things
Discord.js
How does one use the user flags?
https://discordapp.com/developers/docs/resources/user#user-object-user-flags
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Please ping with response. Thank you!
more specific?
oh that flag
yeah bots cant access that
only users can via the get profile endpoint users only last i heard
what am i doing wrong with this code?
client.sql.user = sql.prepare("SELECT * FROM users WHERE id = ?");
should it not work? (it worked before i changed it)
^
TypeError: Cannot read property 'server' of undefined
at module.exports (E:\Canine\events\ready.js:77:18)
at Client.emit (events.js:194:15)
at WebSocketConnection.triggerReady (E:\Canine\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:125:17)
at WebSocketConnection.checkIfReady (E:\Canine\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:141:61)
at GuildCreateHandler.handle (E:\Canine\node_modules\discord.js\src\client\websocket\packets\handlers\GuildCreate.js:13:31)
at WebSocketPacketManager.handle (E:\Canine\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:105:65)
at WebSocketConnection.onPacket (E:\Canine\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (E:\Canine\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
at WebSocketClient.internalOnMessage (E:\Canine\node_modules\@discordjs\uws\uws.js:103:5)
at native.client.group.onMessage (E:\Canine\node_modules\@discordjs\uws\uws.js:57:12)```
oof then what should i define it as?
you need to assign it somthing ;-;
oof aight
can you have multiple on ready /on message events in discord.py
if so how
@bot.listen('your_event')
async def aaa():
etc```
wat
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
console.log(`Loading command: ${command.name}`);
client.commands.set(command.name, command);
}``` i cant find out how to detect a command in a file inside /commands bc im stupid and tired
what error message u getting
add if (message.author.bot) return; on top to prevent the bot replying to other bots (including itself)
top of your bot.on("message" .. that is
Your library tells you if it's a bot or not
No need to use roles
As in other servers ppl probably won't always have a bot role
Well it would still be more efficient
And if you ever forget to give the bot role to one
It won't mess with anything
And I see you're doing some checks if the cooldown isn't active
You're not doing those checks if it is on cooldown
Meaning any message would trigger that?
the channel and bot checking should both be the first thing to be checked
then you go to message checking
also your scopes look weird
your cooldown.add is outside the else
you want to lock the bot to only work on that channel right?
if you do the channel checking only after, then on other channels the bot will still be creating cooldowns for no reason even though it wont say anything
bot.on('message', message=>{
if (commandcooldown.has(message.author.id)) {
message.channel.send("You have to wait 1 minute to do this again! - " + message.author);
}
commandcooldown.add(message.author.id);
if(message.channel.id !== "595279742744133682") return;
if(message.content === "6") return message.author.send(`You choose 6!`)
if(message.content !== "6") return;
setTimeout(() => {
commandcooldown.delete(message.author.id);
}, 60000);
}
)```
i think

