#development
1 messages ยท Page 770 of 1
I don't think bots really should use / as a prefix because it is also used in Discord itself
/shrug
I think bots should uses suffixes instead help! :P
I need some help with Discord.JS
I have a permissions set up for certain commands that looks something like this
if (admin_role && message.member.roles.has(admin_role.id)) permlvl = 2;```
The problem I am having is it doesn't let the commands run if I have them locked to the perm level ๐ค it was working up till yesterday thought I would ask as I have seen a few people saying they are having issues with Discord.JS
No error and no depreciation warning either just randomly stopped working
find takes a function
You should see a dep warning in the console
<Guild>#roles.find(name => name === settings.adminrolename);
Even still, Make it a function so in the future you don't get a dep warning.
Also that might not even be the piece of code causing it to void
Yeah I actually just noticed the part causing it is this
It's not liking reading my ID that way
message.guild.roles.get(settings.adminrole.id);
Maybe your settings object/json is broken?
๐
A database?
True
Which is pretty overkill for id storing
What about .env?
js
<Guild>#roles.find(name => name === settings.adminrolename);
@warm marsh
This won't work at all, you can't just do name => name
Np just to let u know
I meant js ...find(r => r.name === ...);
@uneven wyvern I was actually just gonna ask about a function option
Of nvm wrong thing you were talking about the role ๐คฆ๐ปโโ๏ธ
I will change that setup regardless just to avoid future problems.
Hey guys I needed some help so I'm trying to host a dashboard for my bot, and when I test my dashboard on localhost it works fine but when I test it on my host I keep getting Invalid OAuth2 redirect_uri I'm pretty sure I put the right redirects in but not too sure
The error tells you the error, so the redirect_uri isnt right.
So for the redirects would I need to put in my server IP or can I put my domain for the website
This is currently what I'm using in the config for the bot
And this is on the discord dev
a website shouldnt be using port 3000
isnt that the port glitch uses
yes, but its behind their reverse proxy
good point
the external port is actually normal http/https
is your website running on express?
well what port does Digitialocean have open?
Yeah using express to run it
ah so you are
Yeah I set it up already
but its http only right? or do you have https?
good
then you dont need to specify any port
port 3000 is the internal port, its only between nginx and express
to connect from outside to nginx, use normal https
Would I need to specify a port in my config then??
the only place you need to specify a port is in your express server
and nginx of course
everything else uses http/https which are port 80 and 443 by default, but you dont specify them, the url already does
for example, https://alitadashboard.tk automatically uses port 443, because its https. and it conencts to your nginx, that is listening to port 443
then nginx forwards it to port 3000, which is express
but the outside world doesnt know express exists
they only see the nginx server on port 443
Okay thank you will test that out right now
so basically, all your urls and redirects should not specify any port
Also in discord dev would I need to put the IP of the server has https://IP or do I just leave that out?
use the domain name
nobody needs to know any ip or port, you have a domain name, and you have nginx
so you have a perfectly standard website configuration
Okay thx
o hello
async def ask(ctx, *,query):
res = bot.query(query)
ans = next(res.results).text
await ctx.send(ans)
results in the following error
Traceback (most recent call last):
File "C:\Users\S Som\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\ext\commands\core.py", line 79, in wrapped
ret = await coro(*args, **kwargs)
File "D:\Saved Pictures\bot.py", line 432, in ask
ans = next(res.results).text
File "C:\Users\S Som\AppData\Local\Programs\Python\Python37-32\lib\site-packages\wolframalpha\__init__.py", line 90, in __getattr__
raise AttributeError(name)
AttributeError: results```
who ever made that package needs to be shot for such a shit error description
but assides from that
looks like you dont have an attribute called .results
nope it works sometimes
thats the thing
and each time the error is different
sometimes it says coroutine stopped iterating
some time no attribute next
wtf is it
How can I make the bot use an invite for you? For example you authorize him, and he uses an invite for the user who authorized him to do that. (to get invited in a special-only user discord)
Can't find examples on internet.
you cant
xD
idk what your actually asking tbh
do you mean make an invite
or what
your sentence doesnt make much sense
Because its weird to explain
So, lets say you are premium on a forum. You can join a premium-only discord server, but you have to click a link which authorizes a bot to use invites for you.
Then in ~1 min you're in their discord server
yehhh i dont think bots can actually do that
Idk how they managed to do this, they are not partners with discord or anything.
And it's not the first time a website uses this method
Oh?
oh, okay. I'll check into that.
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
ty
only thing i can think of
its times when making a massive DB that im glad that ORM frameworks exist
they save
so much time
i aint writing my own sql for a 24 column db which contains objects
xD
fuck that shit
i just save json as text in one column
i only keep separate columns for stuff that needs to be indexed
what im doing sorta
alot of the columns already r in json format
but squishing them all together is gonna make it such a mess its easier and cleaner just to have seperate columns for seperating them
For my message event, how can I have my bot check if the message contains an embed, and if it does, how can i have the code return the embed title
in which library
discord.js
Would this work fine?
One message removed from a suspended account.
One message removed from a suspended account.
probably need to clean and rebuild node_modules it looks like
check if your modules are compatible with visual studio 2019
@quartz kindle It says there's a corrupt file, I doubt it's that
there would be a different error it was a build tools problem
Anyone know where I can find how often a certain request to the API can be found?
ratelimits aren't static
follow the ratelimits returned in the request headers
chances are if you're using a lib it already handles it for you
But just in-case
again
ratelimits aren't static
follow the ratelimits returned in the request headers
If you really want to find the rate limits then check the headers
I need y'all help for sentences example: Drop at, Land at, Start at If you guys have suggestions It would be appreciated.
So far I have:
"Alright, start at: ",
"Go to: ",
"Let's the party begin at: ",
"You have to drop at: ",
"Drop at: ",
"Please drop to: ",
"Land to: ",
"You have to land to: "
I dont understand
I need suggestions / sentences for my project.
That suggest users where to drop.
But having just "Drop at: x location" was boring.
Wait I put it in the ApplicationDbContextModelSnapshot.cs file
Yeah I messed up
The entity type 'Assignment' requires a primary key to be defined. If you intended to use a keyless entity type call 'HasNoKey()'.
@abstract crow That's because your Assignment has no Id.
You can tell Entity framework to build your model with no Primary key (Id)
Should I provide an ID? My assignment is setup by the user and its only for them so I didn't think I needed them
Same with Teacher
You should.
Because Entity framework will do relationships for you.
But how do I assign an Id?
It gonna auto increment.
do you want that table to have a PK auto increment? if so search for "EF attribute Primary Key"
Ah ok. So just public int Id { get; set; }
Yes.
Else if you really don't need key:
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Assignment>().HasNoKey();
}
You can override the method OnModelCreating and use ModelBuilder.
Ah gotcha. Imma just use the Ids for now since its recommended
It is always better. For relationships or If example one day you have a problem with Assignment. You can write a query and search it with It Id.
True
SELECT * from Assignments where ID = 1;
Also(sorry lol) I have another question... Now that I can put in data, I am not sure where to go about this now. I know I need to create a controller which will feed the data to the razor pages, but I'm not sure how I incorporate the SQL data in the controller
That's where I'd use Dependency Injection, Repositories, Interfaces
Ok. Hey at least the docs are good! https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-3.1
There is different way to do it.
Directly in the Razor page?
Well you could.
But the proper way is to create a Folder called Repositories by example.
And create a AssignmentRepository class.
public interface IAssignmentRepository
{
void Create();
void Delete();
void Update();
}
public class AssignmentRepository : IAssignmentRepository
{
void Create()
{
...
}
void Delete()
{
...
}
void Update()
{
...
}
}
In your Startup.cs you would have to use something like <Something>.AddScoped<IAssigmentRepository, AssignmentRepository>();.
And in your Razor page It would look like:
private IAssignmentRepository _assignments;
public <Your Controller Name> (IAssigmentRepository assignmentRepository) {
_assignments = assignmentRepository;
}
public Index() {
return _assignments.GetById(1);
}
Assuming you have GetById() in your AssignmentRepository. method.
That's the proper way to do it.
Mhm. I mean I hate to say it but it seems like a little bit too complicated for me rn. I also like the controllers because it just seems more organized for me
Right, would it be easy to make something like the following:
User: b!stt
Bot: Command not found, did you mean "stats"?
@abstract crow Didn't say to use it haha. It is the proper way to do it. But you could do it directly in the controller. It is fine.
Ah gotcha ๐
.
No
It is a string metric to measure the similarity between two strings.
There is probably libs that will do it for you.
@snow urchin What language you use?
Javascript - Discord.js
Are you willing to pay for a service or you wanna do it yourself?
I am not willing to pay
Ok so there is a lib called js-leveinstein, or string-similarity.. or you could use https://www.javascriptspellcheck.com/.
The Cross-platform spellchecker for javascript and jQuery. Learn how to add javascript spell-checking to any web project.
https://www.javascriptspellcheck.com/ gives you the closest words from what a user enter so that might be cool to check it out.
The Cross-platform spellchecker for javascript and jQuery. Learn how to add javascript spell-checking to any web project.
It's not hard to write your own function for it though
For string similitude?
I mean you could with Leveinstein Distance or with Contains, Includes, StartsWith, EndsWith, Regex etc..
is express broken for node 13?
TypeError: Cannot read property 'lazyrouter' of undefined
@sick cloud possibly, did it just start happening when you upgraded?
@west raptor yeah, i think i got it though
its cus i'm using ES
like import and all
Ah ok
were you possibly using destruction methods
@tiny tinsel Apologies bud, I got another question for you. In the midst of all this I realized one thing. Each model(classroom, teacher, and assignment) are different for each student. When a student logs in, I want it to show only their stuff. That means that we may have duplicate entries of teachers in the database(which is fine) as 2 students may have the same teacher. The point of the site is that the student chooses everything and its only for them. How would I be able to filter out these results so I can have them just for the student? The student has an email, but I don't know how I can associate the email with each model..
Well it's obviously a many to many relationship.
Say a student has an array of teacher_id's for each teacher for X class. And a Teacher has student_id's for each student in their class. Where do you think there will be dups?
The student_ids are going to be duplicated for the teachers and the teacher_ids for the students
Are you using SQL?
Unless I add each and every teacher manually, then you select which teacher. Then I have to do that for classes which is impossible
Yes
You can return only unique results if you want.
Right but how can I associate a user's teacher with that user
I'm going to assume table names here
SELECT DISTINCT ARRAY(teacher_id) FROM student WHERE student.id = @someId
Kinda get the idea?
Not really. Lets say I want to list all teachers a student has. I need to associate the teachers with each student
Right so above we just got the teacher id's for a specific student.
Using those id's we can get the teachers info if we so need.
@abstract crow https://www.c-sharpcorner.com/article/eager-loading-lazy-loading-and-explicit-loading-in-entity-framework/
I want to use Shard. But I have one that should be global hashmap. How can I synchronize it. Sometimes a place is deleted from the hashmap, sometimes it is added.
nodejs lang
I know how to create a shard. bot is currently working in a single shard. the problem starts when there are many. I have to share what should be global hashmap. Sometimes I need to delete some of them from every shards.
You can't rlly
Unless you're running seperate processes they should see the same hashmap
But they're is no way to properly sync them because well the whole idea it's async
That's why global vars are not recomm amung other things
UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received type undefined
?
so what did I do wrong this time
there is maybe an exception to the rules of no global variables and that's if the value will remain constant
a constant variable is pretty much no different than reading from a .json file only, so in a sense it's useful for database clients and discord clients
well actually not discord clients
your best bet is probably using something like redis, which is an in-memory database meant to handle that kind of stuff (such as command cooldown handlers and other things that must change often amongst multiple processes)
@analog roost read the error.
alright
Can I send a message to a channel every time a new song is playing? I'm using Discord.js & ytdl-core
well if you have stored the text channel of where the user used the play command
you can upon the dispatcher ends
with .on('end')
end event
you can then send a message with the new song playing
to the channel
So? js dispatcher.on('end') { //code here }

dispatcher.on("end", () => {
//code here
})
dispatcher is in this case your variable with the voice channel connection you are playing the song to
Thank you
Ok so weird random question: With bot cooldown messages, I noticed my bot got declined originally for having them, If i was to make it so a cooldown msg auto deletes itself after around 4 seconds would it be allowed, I ask since Ive seen bots like Tatsumaki get away with it doing that?
How did you implement these cooldown messages before
Because if someone uses a command and the bot replies with something along the lines of "Please wait x before doing this again", that should be completely fine..
Hello, so i am trying to setup mongodb but uh i am getting some errors here, i gived it permissions but it still does throw the same error https://cdn.discordapp.com/attachments/633228963866476554/668019081684713472/unknown.png
service mongod start
Did you try to start with sudo?
@late hill I think i used a embed msg with the same sort of message, Ill redo it with the format you put. Thanks.
lava link
I've tried using lavalink but I can't get it working, ytdl and opus works best for me
It works quite well with high sound quality
@tiny tinsel yeah i did start it with sudo
i can try again
Nope even with sudo it still throw that error
damn
hello,
how do I get a new player role?
i try let role = NewMember.roles.filter(roled => !oldMember.roles.has(roled)).first()
ohhh
hm
whats the ratelimit for fetching messages?
Fetching messages doesn't have ratelimits apparently
It's up to you as a dev to ensure you don't send requests unnecessarily
can someone help me?
This is a cmd for a privatemessage
if(message.content.startsWith(${prefix}dm)){
message.delete();
var user = message.mentions.users.first();
var text = message.content.split(' ').slice(2).join(' ');
if(!user) return message.channel.send("Du hast keinen Nutzer angegeben!");
if(!text) return message.channel.send("Du musst ja schon ne Nachricht angeben");
user.send(text)
}
whats the problem
Looks like you only send a message when there is no user or no text
ok
but when I don`t write a user or text it send me the message for no user or no text
I was wrong, it looks ok to me
Why does it say moment is not defined when it is?
Why did you upload a txt and use a code block
Since canary
gg
its been a thing for the last couple weeks
bot.js 388 const i = await db.fetch(`kufur_${msg.guild.id}`)
DaTaBaSE iS LoCKeD
function rang (item) {
ranks.forEach(rank => {
if(item == rank.position){
console.log(rank.name)
return rank.name
}
else return "net"
})
}
console.log(rang(2))
why return undefined ?
you tell me
you can't return in a forEach
and even if you could
you'd still have an issue because you'd return on the first iteration
where can I host my discord bot for free (24/7)
Google Cloud gives you a year free and I believe AWS also does if you can deal with that.
You can also host on your own PC or a RPi
yeah i haven`t an rpi but thanks for the first ๐
how can i get home addresses and that stuff from a ip?
What the
what wrong?
ever heard of the term privacy xD
you can geo locate an ip
but that wont give you the exact adress most of the time
Dynamic IP ftw
and will get blocked by any dns
well how would I geo locate a ip?
why df do you want to
well, just wanna know how to
why? xD
That's not usually what you should know
because people rather enjoy not having their addresses logged / shown on a digital platform
I'm fairly sure I personally wouldn't like to see my home address posted somewhere on the Internet just because I visited some fucking website
even if it was way off
i wouldnt fucking want a bot that knows my address or even my ip
how would a bot even obtain such information?
ToS breaking ways
anyhow ip geolocation requires a database of ips and addresses, there are some websites and companies that offer such services, such as maxmind
Hi for the revocation link token it is : https://discordapp.com/api/oauth2/token/revoke?access_token=TOKEN ?
a lot of sites geolocate the country of a user via an IP
@bitter sundial well each of them gives you an different location
because they all use different databases
@lofty hamlet if Discord follows the RFC 7009 standard for Oauth 2.0 Token Revocation, it should be a POST request there with an urlencoded body (tho apparently query string parameters as you have shown are accepted by Discord API for whatever reason).
The parameter would be token with an optional parameter token_type_hint which would be set to access_token in your case.
You will also need your client id and secret.
example
POST /api/oauth2/token/revoke HTTP/1.1
Host: discordapp.com
Content-Type: application/x-www-form-urlencoded
token=aBcD123&client_id=987654321&client_secret=45uVW67Xyz
@bitter sundial this is token = and not access_token = ?
And i do put the client id and secret ok
message "405: Method Not Allowed"
I want to make an android app. Android Studio lets me choose Kotlin or Java as coding language. Which is more similar to node.js?
Uh, neither that I'm aware of
idk
android itself is based on java, so not much choice there
if you want to use node, you need to code an app that uses webview or something
there are a few compilers out there that can build js code to something android compatible
but its not an easy thing
@quartz kindle u can help me plz ?
i mean there are frameworks like xamarin but that's for c#
which cry is this
The og
yee
idk at this pointlol
oh
anyways, i dont think node would perform well on arm anyways
RPi is arm and it runs ok on that
anyone good at reaction collectors?
var embed = new Discord.RichEmbed()
.setTitle(pollTitle)
.setDescription(desc)
.setTimestamp()
.setFooter(`initiated by ${message.author.username}`)
let emb = await message.channel.send(embed)
await emb.react('๐
ฐ๏ธ');
await emb.react('๐
ฑ๏ธ');
const reactions = await emb.awaitReactions(reaction => reaction.emoji.name=='๐
ฐ' || reaction.emoji.name=='๐
ฑ', {time:pollTimeout});
console.log(reactions.get('๐
ฐ').count);
this tells me that it cant read the property count of undefined
whats wrong rn?
even tho i react with ๐ ฐ๏ธ
that's a lot of awaits
yup, is that bad?
hm ok i just cant figure out why it wont work , i copied it exactly from a video
i mean i edited it for my use
outdated probably
maybe ill read the docs lmao
yh
are you on master or stable
6.4.1 d.js?
i made this bot ages ago and kept adding commands and making it better
on 6.4!?
lemme see
was made on the 18th of march 2019
idk when 6.4 was released but i think i just did npm i discord.js when i created it
1 year is not even that old
my bot is like 3 years old, and back then d.js was already on version 11
are you sure thats not your node.js version?
that makes no sense lmao
genuinely dont know
there isnt even a version 6
was diffrent
hes gone back in time
bruhh what
you cant use npm -v on a package
dam
either open your package.json or try npm view discord.js
ok thanks, it said im on 11.5.1
thank jesus
๐คฆโโ๏ธ
how can i change the avatar coordinates
go to the arguments press backspace and then your coords
@amber fractal i will try thx
@amber fractal
well where are you trying to place it
in middle
Images in canvas draw from the top left so do you know how to center an image that draws from the top left?
no
hint:
x = width / 2 - imageWidth / 2
y = height / 2 - imageHeight / 2
well yeah that 
where should I write this?
Not exactly like that, but it's your x and y
you should think how to apply this formula
copying and pasting exactly what i wrote will not work
do you know what are x and y?
ur version is wrong?
make sure intellij is looking at the correct sdk
lol you're on an outdated sdk probably
in your project structure you can change the sdk version because as far as i know intellij ultimate is dumb
Does anyone know how to convert all raw messages in a string into usernames, I have a bot command in discord.py 1.2.5 that takes a message to generate a image using it but the message contains things like !@12398719238712123980 instead of actual names. I tried using regrex but because I dont usually use it I dont know how to make this work with it.
because its a mention and thats how discord sees mentions
That's how mentions work
get the ID from the <! >
It's your client converting them into readable state
and get user from that
well you kinda need to know
otherwise you aint gonna get anything we tell you
and clearly you dont
otherwise we wouldnt be here
xD
get the ID from the mention, get_user or fetch_user that ID, return the string
thats all
That's probably what should make sense
I just want to know how to turn a string like "blah blah !@8374389274" to something like "blah blah randomUser"
string.replace, use regex

connect those two together uwu
learn it then
only way ur gonna do it
and regex takes like 10 mins to learn the basics todo what you need todo
me neither, let's suffer together trying to understand regex
or read the docs
I forgot about read the docs, thanks shivaco

Im so used to StackOverflow that gives me tons of useless code
beacuse you shouldnt copy and paste and use others code
when 90% of d.py stuff is outdated
d.py docs are easy to understand
regex slightly worse off
but plenty of basic tutorials on it
from what I know I can use a re.match to find terms
making those terms tho
thats the challenge
thanks for the help tho
hey guys, how do i make an int into char(ascii) in c?
for example i have the int 928, i want to make it into char[3] = '9', '2', '8';
owo what
how can i make an int i have into ascii? i know how to do the oppisite but not an int into ascii
(in c)
Would this help?
i cant use stuff like convetr.tochar or stuff like that
cuz like lets say my int is 4, i will do 4 + 44 which would be 48 which is '4' BUT how do i make that 48 into a char?
Can you to itoa
nope
not sprintf either
A networking guy walks into a bar with a bird in his shoulder. The bird keeps repeating "pieces of nine, pieces of nine". The bar tender asks what's up with your bird, shouldn't it be saying "pieces of eight"?. No says the networking guy, that's just a Parrotty error...
itoa(), @topaz fjord
xD
anyone else had a problem with randomly missing messages?
for example, i have a bot that sends a welcome message with instructions to enter the server, and when a person joins, i can see the bot's message, but sometimes the person who joined cant
even though they can see past messages, and they see all other messages in the channel, only their specific welcome message is missing from their chat
if the welcome message is sent in an embed they could have embeds disabled
if not, just blame discord and nothing you can do about it
yeah, im blaming discord
they can see past welcome messages
let me show an example
this is what i see (notice the timestamps, they left and rejoined)
this is what they see (they sent me the screenshot)
the second welcome message is completely missing from their chat, and they're trying to solve the first welcome message
slow internet could be a reason, they're failing to catch up to the message events
for the bot the user is already in the guild but for the user, if they have slow internet, they might be a bit behind and still in a state of joining
and by the time the message event is sent out the client ignores it because the client still thinks the user is in the middle of joining
well, he was sitting there for an hour, trying to solve the old captcha
then he was auto-kicked for failing to solve it
lmao
then he rejoined a third time, and it finally worked
the reason they see old messages is because of the rest request which isnt realtime
websocket is iffy though
yeah im guessing for some reason the websocket failed, and then the client didnt send any fetch request because, well, there was nothing to update client side
but it kinda sucks because its not the first time that this happened with this bot
i've seen it happen a few times before
have you thought ab delaying the message for a few hundred ms? might help
hmm good idea
can anyone explain to me why this returns Window when ran in a browser and global when ran in node?
Function('return (function() {}.constructor("return this")( ));')()
i think i understand it to the point of {}.constructor("return this")
i didnt
to me it just seems like it's calling several nested functions
it is
so what are you confused about
i just dont understand wat {}.constructor("return this") does
well i mean
i know its just this
but idk why
All global variables and functions you create are added to the global namespace
which is "global" in node
and "window" in browsers
I have a function
function Person(name){
this.name = name;
return this;
}
alert(Person("somename"));
This is returning [Object Window], how we can change this to [object object]? Is there any wa...
read the error
and dont say you have because if you did you would know the issue
Anyone by any chance know how / why Im occasionally getting my DB on a diffrent thread to the thread calling it raising an error
even tho in theory they should be the same
i think its if multiple threads get started
Maybe 2 threads try to connect with the DB at the same time and it causes an error?
I added a read/write lock for every DB interaction,
multiple threads are allowed to read at the same time, but only 1 thread can write at a time
i think it cuz as one thread finishes a new thread is immediately created not giving enough time for the async task to finish writing to db
Yes i tried several things but nothing conclusive
@fierce thorn CodeBot should be fixed now.
Thx Tim
this doesnt work whyy??? I tried so harddd to fix
Also you need an arrow function operator not as assignment operator for the callback on the message event
There are a few errors with what you sent
I'm not gonna spoonfeed but the errors you get should be self-explanatory
Please hide your token
^ was about to mention that as well haha
how can I read a varchar with jda and litesql? So that I have the varchar as a string
@cursive kiln regenerate your token
@modern sable maybe you need to remove a post that contains a token?
doesnt really matter I guess, it leaked already
@fallen lion Are you trying to read it from the sqlite database or trying to put it in the database?
sqlite has no varchar datatype, it is probably saved as text
i try to read it
You can just read it from the database as a string
how do you mean?
PreparedStatement stat = connection.prepareStatement(SELECT_QUERY);
ResultSet rs = stat.executeQuery();
if (rs.next()) {
String value = rs.getString(VALUE);
// do something with it
}
// close it all or put it in a try block
okey
I guess you are using prepared statements
yes
How can i use command handler?
@blissful scaffold what do you mean by "value"?
Const Discord = require('discord.js')
Const client = require Discord.Client()
client.on(message, async msg = {
if(message.content = "info") {
Message.channel.send("Hi i am warrior the best bot that will give you everything you want")
})}
Client.login(Blah blah blah)
Is this correcter? Sorry im bad at english
It still dosent work
rs.getString(VALUE);
VALUE can either be an int (columnIndex) or String (columnLabel)
@fallen lion I see you are using Eclipse
Eclipse tells you exactly what it expects
@blissful scaffold I always get null
maybe that is what is stored in the database
https://sqlitebrowser.org/
I use this program to check what is in my database when im working on it
@cursive kiln arrow function as callback, not assignment. And that message is never gonna send, you aren't using the correct variable name for the message object in the func body
Mostly capitalization errors from here
Whats callback
So question, what's wrong with this code
if (message.content.startsWith(prefix + "ban")) {
if (message.member.hasPermission("BAN_MEMBERS") || message.author.id == "509122806663872530") {
var modBanning = message.author.username;
var reason = message.content.slice(prefix.length + 4 + mention1.length);
if(!message.guild.roles.find(mention1, 'Admin') && !message.author.id == "509122806663872530") {
message.channel.send("Banned " + mention1 + "!");
console.log("User: " + mention1.username + ", ID: " + mention1.id + ", was banned by: " + modBanning + ", Because: " + reason);
}else {
message.channel.send("That user cannot be banned via bot, try it manually");
console.error(message.author.username + " tried to ban " + mention1 + " to no avail!");
}
}
}
Specifically the if(!message.guild.roles.find(mention1, 'Admin'), it says, that the augument must be a string, but I cannot read the username of mention1
mention1 = message.mentions.first();
Not checking if it has an arument in the first place, no checks if the bot has ban perms and silent ban command if the user does not have ban perms mkay
Also why are you mentioning the banned user when they get banned then their mention won't resolve for others 
this code is just yikes tbh
can someone help me?
let args = message.content.substring(PREFIX.length).split(" ");
switch (args[0]) {
case 'mute':
var person = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[1]));
if(!person) return message.reply("Ich kann die Person " + person + " nicht finden.")
let mainrole = message.guild.roles.find(role => role.name === "normal");
let role = message.guild.roles.find(role => role.name === "mute");
if(!role) return message.reply("Die Rolle `mute` wurde nicht gefunden.")
let time = args[2];
if(!time){
return message.reply("Du hast keine Zeit angegeben!");
}
person.removeRole(mainrole.id)
person.addRole(role.id);
message.channel.send(`@${person.user.tag} wurde fรผr ${ms(ms(time))} gemutet!`)
setTimeout(function(){
person.addRole(mainrole.id)
person.removeRole(role.id);
console.log(role.id)
message.channel.send(`@${person.user.tag} ist nun unmutet.`)
}, ms(time));
}
whats wrogn there?
Let me see
I think its the part var person = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[1]));
you cant call on some one like that
ok
It would be something like this
const to = message.mentions.members.first() || message.guild.members.get(args[0]);
getting the following error in my music bot : [tls @ 000001f5e079e400] Error in the pull function. {link of the song}
How you do to use the bot with de mention ?
-bots
This user has no bots
| Okay, Sorry
Sry
Smh
can someone tell me which one i select for my bot database
what are you trying to do
i want to connect my bot to database
is that the mongodb installation software or whatever
@earnest phoenix if you want to get a connection string, select "Connect Your Application"
now what i do
2|atlanta | [2020-01-19 00:22:47.814]: ERROR Unable to connect to the Mongodb database. Error:MongoTimeoutError: Server selection timed out after 30000 ms getting this error
what is your mongoose version
"mongoose": "^5.7.13"
but whhen i put my frnd db url its works and when i put my it shows me that error
do you whitelisted your connection IP address?
how to do that
ive seen some packages but they dont work for me
@earnest phoenix https://stackoverflow.com/questions/59162342/mongodb-connection-error-mongotimeouterror-server-selection-timed-out-after-30
@glacial anchor with turndown package https://www.npmjs.com/package/turndown
i tried it earlier
didnt work
but i'll try again
i have a multi-line html file
Ist grad jmd hier der Erfahrung hat? ich finde den irwie den Fehler im Code nicht..
ok
@earnest phoenix post the error and the relevant code
@summer torrent
@earnest phoenix U use the AtlantaBot Source lmao
@earnest phoenix Bei was brauchst du Hilfe?
do you get any error
i change the ip
@summer torrent ok turndown worked, ty!!!

No one has to help you man.
y
Why? Cause you're not entitled to it.
:/
My best guess is you didn't make a DB or you typo'd the DB name when trying to connect.
i just click on connect then connect to application then copy the url and paste in my bot config.js
and replace password to my mongodb password
this
i have created
and replace password to my mongodb password
@earnest phoenix password isn't a your mongodb password. It is a password of database user
replace password (on connection string) with password of your database user
where i get that
You set it when creating the database user
ohk wait
still same error
| at TLSSocket.Readable.push (_stream_readable.js:214:10)
| at TLSWrap.onStreamRead (internal/stream_base_commons.js:186: 23) {
| name: 'MongoNetworkError',
| [Symbol(mongoErrorContextSymbol)]: {}
| },
| [Symbol(mongoErrorContextSymbol)]: {}
| }
| MongoTimeoutError: Server selection timed out after 30000 ms
| at Timeout._onTimeout (/root/pikachu/node_modules/mongodb/lib/c ore/sdam/server_selection.js:308:9)
| at listOnTimeout (internal/timers.js:549:17)
| at processTimers (internal/timers.js:492:7) {
| name: 'MongoTimeoutError',
| reason: MongoError: Authentication failed.
getting this error in logs
@summer torrent

what happend
i have putten proper password
Have you removed the <>?
yes
yes
my advise, delete all commands and remove the mongoDB fully
I use Atlanta Bot Source also and I did it like that
Mongo sucks anyways
yeah, it's good but very complicated to understand
#whitenames
stfu
is not so that I have 3 Discord Bots with over 6000 servers on my old Discord Account... @marble juniper
either stop your 3 year old responses or go to dms
/:
@earnest phoenix I wouldn't apply a bot with a known bot source.
means
delete the commands and make your own :D
y
because stealing is bad and you learn nothing from stealing it
if there is an error you won't even know why and where
try coding your own commands so you actually know what it does and you can then Improve on skills
At least try it
and I recommend using a command handler because it can get messy once your code gets longer and longer
^
let akce = db.startsWith(`akce_${message.guild.id}`, { sort: '.data'})
what can I use instead?
@summer torrent yes
is this quick.db?
yes
you can use sort() with db.fetch()
@summer torrent can you look dm?
Why?
because you're labelling a voice channel object as a server and that starts making life confusing
Yes, I made a mistake, it seems more logical to me but its still not working
@client.command()
async def connect(ctx):
await ctx.author.voice.VoiceChannel.connect(timeout=60.00, reconnect=True)
well i mean youre trying to connect to a user's DMs voice call
@ NMW03
0001 Can You Help Me Install top.gg Bot
<@&265158261945270273>
Can You Help Me Install top.gg Bot
Don't pping Web Administrators
I dont even understand the question
Do you want to add a bot to your server, or do you want to make a bot?
And now ?
@client.command()
async def connect(ctx):
channel = ctx.message.author.VoiceChannel
await client.channel.connect(timeout=60.00, reconnect=True)
No, there are problem
isnt it just VoicChanne not Voice.VoiceChannel
Its still not working
I am making a dashboard for my Discord bot. After the user is logged in I have the variables user & guilds, when I try to do
<% guilds.then(function(result) {
console.log(result)
}) %>```
It gives `{ message: '401: Unauthorized', code: 0 }`
How do I fix that?
what are the oauth scopes
https://discordapp.com/api/oauth2/authorize?client_id=${CLIENT_ID}&redirect_uri=${redirect}&response_type=code&scope=identify
did you exchange the code for an access token
What do you mean?
identify doesnt provide you the guilds
401 means wrong token
I changed it to https://discordapp.com/api/oauth2/authorize?client_id=${CLIENT_ID}&redirect_uri=${redirect}&response_type=code&scope=identify%20guilds
but still get the error
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
you have to exchange the code you get for an access token
A code you get from the user when it logs in?
I console.log() that code, how do I use it to get the guilds?
I don't understand how to do it ๐
what part of it
I have the acces token when the user logs in, but I don't know how to use it to get their guilds
"everything"
Mhm
I was using this
async function getGuilds(serverid, token) {
const response = await (await fetch(
`https://discordapp.com/api/guilds/${serverid}`,
{
method: "GET",
headers: {
Authorization: `Bearer ${token}`
}
}
)).json();
return response;
}```
Hey i have a problem with a bot of mine.
The bot always goes offline after a certain amount of time then I took another bot with token and it works.
How can I fix it?
Maybe an error?
Does anything get logged in your console, like an error?
Anyone here who worked with Xamarin?
anyone got any idea why occasionally the Database is being started on a diffrent thread and process to the rest of the code
alchemy confussles me somtimes
JS?
I think those async and await calls run on a different thread?
But I don't work with JS so I don't really know
python
how can i console.log numbers from 1-1000?
ok I've never for loops but let's see
ok wtf my keyboard just did
var points = new Array(10);
var label = points.length;
for (var i = 0; i < label; i++) {
console.log(points[i]);
}
}
run()```
logs undefined
Where did you put logs
i mean, if you want to only print the numbers, you can simply do js for(i = 0; i < 1000; i++) { console.log(i) }
oh well that's the easiest way ig
does anyone know how to combine the queue and the play commands together with this code ??
https://paste.pythondiscord.com/iyadizarof.py
your code was returning undefined because you created an array with 10 entries, those 10 entries are undefined by default
then you attempt to log each individual entry
@quartz kindle Ok how would I loop trough an array of words?
let array = ["word1","word2","word3"];
// using a regular "for" loop
for(let index = 0; index < array.length; index++) {
console.log(array[index]) // or do anything else with it
}
// using a "for of" loop
for(let item of array) {
console.log(item) // or do anything else with ir
}
// using a "for in" loop
for(let index in array) {
console.log(array[index]) // or do anything else with it
}
a for loop is a basic loop present in most programming languages
for in and for of are shorcuts for looping specifically over indexes and values. additionally, a for in loop can loop over an object's keys
Thanks :D
Can We "Publish" Messages Using Bot? d.js If It helps (Like Publish In Announcement channels)
can you publish a message posted by a bot tho
I not found the solutuion for my bot join server voice channel ๐
@client.command()
async def connect(ctx):
await ctx.message.author.VoiceChannel.guild.connect(timeout=60.0, reconnect=True)
What are you expecting author.VoiceChannel to be
I want the bot to join the channel of the member who writes the command
@mossy vine Yeah
Lol
@dull terrace have you looked at the documentation? i found it in 1 min
God damn tim
idk if Tim is pissed or doesn't know how else to explain it
Lol
Does anyone why snowflakes exist?
Bcs this seems like a pretty big loop for smth that could be done easier. ยฏ_(ใ)_/ยฏ
give a man a fish, and he will eat for a day (and beg you for another fish every day)
teach a man how to fish, and he will eat for a life time (and leave you alone for the rest of his life)
lmao
because you're able to generate millions of snowflakes within a second
Why is that @earnest phoenix ?
ty
welp, just pushed the massive update
I am full of attempts, but nothing conclusive
lets hope nothing burns
Quick question... My bot was declined for Returning NSFW content outside of a NSFW channel (I wasn't aware the images could be NSFW) but I was wondering if this is a good enough fix.
Sorry I deleted the message the first time LOL I attached the wrong image with it....
Yeah that's fine
Awesome ๐
the autosharding system is doing its job
but because the events r broken
having to use my own system
which mean
when autosharded system says "hey we dont need this shard cuz we're not at 2500 yet" the system doesnt finish booting
Tim why VoiceState ?
cry has only sent 1000 messages outside of this channel also, so i guess tim and cry own this channel 
i don't need that for the bot to join the channel though?
member contains VoiceState
Hi
VoiceState contains VoiceChannel
Hello @visual zenith
Ok
@ruby talon nice pp ๐
ikr, we should take this convo to #general or #memes-and-media tho. ^^
i still don't understand sorry ๐ข
might be time to learn OOP with python
Yes, that's what I'm going to do
lets start again, with message: https://discordpy.readthedocs.io/en/latest/api.html#message
go to message, and scroll down, you will see all the properties that a message object has. you know what is a property right?
for example OBJECT.property
message.author
author is a property of message
so in the docs, you see that author is listed as a property of message, that means you can do message.author in your code
but what does message.author give you? the docs tell you what it gives:
authorยถ
A Member that sent the message. If channel is a private channel or the user has the left the guild, then it is a User instead.
if the message came from a guild, it gives you a Member object
so that means, if the message came from a guild message.author is a Member
now click on Member in the docs, and you will see the list of properties a Member has
search for anything related to voice, and you will find this:
voice
Returns the memberโs current voice state.
so voice is a property of Member and message.author is a member, if the message came from a guild
that means in your code, you can write message.author.voice
then in the docs, click on VoiceState, and you will see what properties a VoiceState object has
and so on
just continue through the docs that way
untill you find a voice channel, and until you find the connect function
jeuss so much stuff is breaking
When its channel, I can replace this per VoiceChannel?
I know I'm missing something because VS Code has to show me the options of .connect
I have an array of user guilds. How do I create a new array with guilds the user has permissions MANAGE_GUILDS. I know something with array.filter() but not exactly how to


how df did that