#development
1 messages · Page 740 of 1
oh
and see if it outputs something close to mine
do you understand how cmd works
no
oh amazing
haha
i won't teach you the basics, you have google for that
you have to run youtube-dl.exe in the location where youtube-dl.exe is located in
also remove {} in the args
when i ran it
can you post your entire Program.cs on paste.mod.gg, removing your token if it's in your code
i do not know why you're getting a nullref
hm
try following this https://gist.github.com/Joe4evr/773d3ce6cc10dbea6924d59bbfa3c62a
it might have something to do with this line client.CreateDirectPCMStream(AudioApplication.Mixed, 96000);
and it is
you're trying to feed it direct PCM stream which is a nono
use CreatePCMStream and AudioApplication.Music
there's your problem
wait so i dont need the link u sent?
nope
remove the 96000 argument
i know
the error is not from there
i can't point my finger at where the error is because your system font is not renderable in cmd
so what should i do
i guess yeah the last thing to try is to try catch in your MessageReceived handler
where is it
yes
thats all what it shows
what's line 54
i don't get how that can nullref
Not a lot of people here used C#
so basiaclly my bot will never work?
it will
can you atleast google ur answer and see if someone already got that problem please
However I personally don't know C# to help
were not gonna spoonfeed you the basics of the language
but thats not the basics
try to remove the or part which checks for the mention prefix
by that i also meant to remove the actual method itself
hehe
so you're only left with HasCharPrefix
try to
i don't know where else a nullref could come from
you literally check is message is null and return if it is so the message can't be
i helped you resolve that part
it had no connection to voice
i don't get why voice won't stream
can you post your updated AudioService**
to paste.mod.gg
this is why
remove that starting point
you're already starting with youtube-dl.exe
you don't need the path to the file in the arguments again
what's your code now?
oh wait
ill put
a url
Arguments = $@"--no-check-certificate -f bestaudio {url} -o - | C:\ffmpeg\bin\ffmpeg.exe -i pipe:0 -f s16le -ar 48000 -ac 2 pipe:1",
no sound is being heard
try adding -hide_banner -loglevel panic after ffmpeg.exe
the problem might be that ffmpeg is outputting its configuration which is invalid audio
still not working
maybe i should change it to just ffmpeg.exe instead of all that c:\....
it genuinely doesn't matter if you have ffmpeg in the c:/ffmpeg/bin directory
i dont know then
i guess check if ffmpeg is there
it is
no, in c:/ffmpeg/bin
it does
i don't know then, compare your code to a sample that works
i posted one above
the sample is obviously for local files
alright ill keep working on that tomorrow imma head off to bed now thank you very much for all the help
i really dont know how to thank you enough
if i have a string which is math (ie. 10/5) how do i take that string and run it to get the result (ie. 2) in python?
eval if you trust the source
There's the evil eval keyword
if you don't trust the source i've seen people use pyparsing
How am I supposed to interact with functions and variables from one file in another?
I am currently trying something like this:
// main.js
var settings = module.exports = {
"124153124": { // Guild ID
"125135134": { // User ID
//Settings
}
}
}
module.exports = function setUpGame() {
// content
}
//game.js (command file)
const settings = require("../LDS-Bot.js").settings;
const setUpGame = require("../LDS-Bot.js").setUpGame;
if (message.guild.id in settings) {
if(message.author.id in settings[message.guild.id]) {
setUpGame(); //start game
} else {
//add to guild
setUpGame(); //start game
}
} else {
//add guild to dictionary and user to guild
setUpGame(); //start game
}
FYI: setUpGame(); needs to be able to run a function that is in the main.js file.
any help would be appreciated
@earnest phoenix python has eval?
@slender mountain do what you just did... export the function and require it in another file
what about the dictionary, does that work as well?
Python does have eval yes
You can also turn a string using int()
If you want to say divide the number split on the "/" and then int the list
@amber fractal currently it throws an error that says: TypeError: Cannot use 'in' operator to search for 'GUILD_ID_HERE' in undefined
settings must be undefined then
guys i shit and cummed what do fuck fuck time to shoot up some herion
that's worse
shart teh fuark up poo head
@west raptor
oh ok
How do you make a message all one paragraph, because my help command give 18 DM's...https://prnt.sc/q6dz61
you could try embeding
const talkedRecently = new Set();
if (talkedRecently.has(message.author.id)) {
message.channel.send("You have to wait 1 hour before doing this command again!");
message.delete();
return;
}
talkedRecently.add(message.author.id);
setTimeout(() => {
talkedRecently.delete(message.author.id);
}, 3600000);
let score = client.getScore.get(message.author.id,
message.guild.id);
if (!score) {
score = { id: `${message.guild.id}-${message.author.id}`, user: message.author.id, guild: message.guild.id, points: 0 } }
score.points += randomNumber;
client.setScore.run(score);
message.channel.send({embed});
}
I tried making a cooldown for my ~work command but it look like the cooldown dont do anything at all

Do you use external commands or all in one file?
external
Okay
The variable gets created each time the command is called.
You need to pass it through or add it to message or client.
ohh i c thank u
No worries.
Thank you it work now @warm marsh, I added it into client.Cooldowns = new Set(); so its accessible through other files in my index.js
👍
@opal halo consider making a single string or something that resolves into a string and sending it to the user. If you want to be simple, you can use the split option for the 2nd argument. For example:
let cmds = ["BAN: Bans a user", ...];
message.channel.send(cmds.join("\n"));```
sending over 18 messages is a horrible alternative
in d.js what would be the best way to keep track of time for like a mute command. like how long the person needs to be muted for and then automatically unmute them?
Create embed instead
wdym?
Is anyone here a gfx maker
@steel cloak you should get the milliseconds and store it in case your bot unexpectedly goes offline. Periodically, check if the time has expired (or use a setTimeout) and execute your unmute stuff if it's passed time.
If you're getting time from user input, the ms module is recommended
ahh okay thanks so much!! have a good day (or night) 🙂
._.
honestly command cooldowns are probably handled best in a db of some sort
but not creating a new document for each command used
especially if you want commands that can only periodically be used such as 1 week intervals, then bot restarts won't matter since it's in a db
if you have maybe 3-5 second cooldowns on all commands this wouldn't be necessary but would alleviate memory usage if it were in a db
Help me, "C"
isnt that a simple maximum search
define an int called max with 0, loop through the elements of the array, if the element is larger than max set it to max, return max afterwards
let args = message.content.split(' ').slice(1);
if(!args){
let msgchannelid = message.channel.id;
} else {
let msgchannelid = args[0].replace(/\D/g,"");
}
let chn = msgchannelid;
var snc = snipes[chn];
Why is he telling me that msgchannelid is not defined?
because it isn't
learn how variable scoping works
But even in const or var he tells me undefined
again
learn how variable scoping works
because snipes isn't defined, and cry is right
No
let chn = msgchannelid;
This isn't defined
snipes je defined x)
But okay i go To learn
does anyone have an example of the post data sent from the voting webhook?
im assuming its just a json object within the post body, no form encoding at all
yes?
isnt it on the docs
that bit isnt clear
it says "JSON params" but it isnt clear if that json body is within form-encoded params or not, and i cant just do a vote to see
as i already voted today.
not always
ive seen apis that do this:
JSON={url-encoded-json-object-here}```
and, the docs dont indicate a mimetype of the body, so im having to ask
for now i'll assume its just a json object in the post body, and that the content type is application/json, e.g. the sensible choice
thanks, thats what i wanted to know
you could test the webhook
what ive learned over the years is never assume an api is sane
by going to your bot page and using the testing button
does it post a vote?
not really sure
well, lets find out 🙂
its meant for testing
yup it does
nice
now i just need to find a way to give someone this role without having to hack that into my bot
brb, time for some light reading... thanks willi123yao
np
hello guys
i have a problem with my discord bot that i made with c#, everytime i try to put a song, he joins the channel but doesnt play anything... i am using ffmpeg and youtube-dl, does anyone have an idea on what could be the problem?
@earnest phoenix
@earnest phoenix consider reading about scopes:
https://developer.mozilla.org/en-US/docs/Glossary/Scope
@sudden geyser thank you 
How do I pick a random file from folder?
js
use fs.readdir
it's going to give you all files inside of the directory
from there on it's just randomly picking from an array
I searched on google, but I don't know how to use fs.readdir
Yes, but then?
So I’m having trouble with discord.ext tasks (Python). It appears that tasks with code inside that uses await do not start, but tasks that don’t use await inside of them work fine.
@tasks.loop(hours=3)
async def activity(self):
with open("playing.txt", "r") as file:
playing = file.readlines()
await self.bot.change_presence(activity=discord.Game(name=choice(playing)))
print("========== ACTIVITY UPDATED ==========")
This is the task I am trying to make, I have verified that the cog that contains it is loaded and without await self.bot.change...... the task works. But with that included, the task never appears to be started.
yay, its done 😄 my bot now auto grants a role on the official server to anyone who votes for it on top.gg 😄
Cool!
Right
So
Why df do you need to create a new event just to change presence
Just create a background task from on_ready
I like to group my code, loops should go in the loops cog, etc...
Ig if I can’t find a way to fix it I’ll just do what you said
You can still put loops in loops cog etc...
Oh I see what you’re saying
All you do when creating a background task is run another function on a independent thread
Could this be done using just discord.ext and discord or would I have to use the threading module?
You don't use threading with async if you want to live
U legit just use what async gives tou
Async has a create background task wrapper
Which handles running background tasks for you
So I could just have it triggered on an event like on_ready
K
Thanks!
now we'll just have to see if anyone actually votes for the bot to get the role. the bot takes the role away after 24 hours unless you vote again, so...
After around 45 minutes of unwillingness to read any documentation, I think I got it to work properly!
Thx chillfish!
Does anyone know where I put
module.exports = require('./lib/lint/');
this at?
In a file
@atomic quarry whats idea of that?
const anything_you_want_to_call_it = require('./lib/lint/<somefile>js'); OR
import anything_you_want_to_call_it from './lib/lint/<somefile>.js'
those are right, and if you want to do for whole directory use, fs.readDir.
Say?
Do you mean send to a channel?
@earnest phoenix Regardless, the documentation is a wonderful resource, here’s a link if you forgot it: https://discordpy.readthedocs.io/en/latest/index.html
ok
in d.js on a bots ready event can it get a user in a guild or does it need to cache (or fetch) them or something?
and on master client.users.fetch()
ahh okay thanks!
@earnest phoenix my father died yesterday :\
and i need to know that because...?
you don't need to cry about your father if he never liked you 
Hello folks 👋 Discord py question:
Any idea why I cant pull a guild-object for any of my guilds, even the ones my bots in 🤔
I'm using client.get_guild(id) @ async on ready (thats a long story), anyways its worked before the update to 1.2.5 which is the strangest part 😦
oh and I am connecting using client.run() after initializing the client if that helps
I'm able to get user object with client.get_user(id) in the same instance just fine
Did you put fetching guilds off from your client settings?
And what you are using: (AutoSharded)Client or (AutoSharded)Bot?
oof that may be that case! I didn't create the client with fetching guilds in mind, i think thats it!
and the bot is an autosharded bot*
So unfortunately that wasnt the case :/
Here's the relevant script, ill edit it here to make it a bit easier to work with
client=discord.Client()
@client.event
async def on_ready():
global idd, typ
this = {}
this['id'] = idd #$idd is correct
try:
server = client.get_guild(idd)
except Exception as EEE:
print(f'{"response":"Error! Guild not found!", "error":"{str(EEE)}"}')
cont = False
exit(0)
if server.name == None: #Failing Here <
#Using guild.name to check if not None <
print(f'{"response":"Guild not found!"}')
cont = False
exit(0)
if cont == True:
try:
this['name'] = str(server.name)
this['owner_id'] = str(server.owner_id)
try:
client.run(TOKEN)
except Exception as grrr:
print('{'+'"fatal_error":'+f'"{grrr}"'+'}')
sleep(.1)
exit(0)
-daemon.py", line 63, in on_ready
- if server.name == None:
-AttributeError: 'NoneType' object has no attribute 'name'
Looks to me like server is undefined
have you tried logging what server brings back?
good call, trying now 🙂
Ok so server is None, referring to the docs that means "couldn't find guild"
Just a note for you you can't get a guild object by doing client.get guild on a guild object
Client.get_guild is what you use to get the guild object
Also you using exist(0) which if I remember right closes python
That is baddddd
Because if a shard dies the program won't restart and create a new connection
I wouldn't advise it
ok thank you
i'm quite sure my client is the issue, my main bot pulls it just fine, this is a very strange issue 🤔
There are alot of things I don't like about that code tbh, mostly the use of exit() which you don't need in a async subroutine, secondly your putting client.run(token) in a try and except which is a lil weird seeing that you want it to crash and display the full error on a invlaid token
ok I will work on that lol
Overall the error is that it can't find the guild with that Id now I have no idea what you're using for the id but if the bot isn't in the server I don't think it can actually get the guild object
its for an api btw so it really doesn't need to be coro, ill probs use php for this mess 😩
Thats true but i cant even fetch my admin-level servers with this instance
this is working @ on_message() just fine: guild = client.get_guild(message.guild.id)
How r u getting idd ?
idd = 632649478288965703
Where is that being assigned?
Are you waiting until your bot's internal cache is fully ready
lets try logging that actually, good call!
@slender thistle thats what i'm thinking is the issue
If it's going off on_ready it should go when internal cache is ready anyway
Altho message event will start firing instantly on ready should go on cache ready anyway
ok lets do it 🙂 brb
I very highly doubt on_ready is fired when client is FULLY ready
I just wonder where he's assigning idd
If he's making it global in on_ready
Where df is the assignment
God knows but does that matter in this case
Yh would explain why he gets a none type error
idd = the id, just ran that test
If you Id is being assigned in a subroutine making it a local variable before you are telling it that it's a global var you're gonna get a none type error
NoneType error is because you are trying to get a guild your bot is either not in or your cache is drunk at the time of getting the guild
Or it can't find the guild you given it ¯_(ツ)_/¯
yea this is madness :/ Most likely its my client, waiting for async def wait_until_ready():
was unseccessful (never fired)
What
Did you read the docs on wait_until_ready
Lol
Idk what your were doing there xD
/ demonstrating
Mostly concerning about i-love-children
XD
shh
If they did what I basically tried, there would be a NameError, not AttributeError because of None.x
I'm just thinking he's assigning idd somewhere when it is a local var
Seeing that there is no where in the on_ready() event where he assigns it
And he only makes it global in there
I'll just aggressively shrug it off because python never lies
If he's got it in on_message or a different subroutine he's got it as a local variable to on_ready
Which defualts the var to none
And on_ready only fire when discord client and cache are loaded
I wouldn't say that's the case
¯_(ツ)_/¯
You've made idd global by having it outside any subrutines
Ah yes pastebin I can't read because it doesn't work for me
It's 133 lines 
He's assigned idd at the top of the code outside a subroutine
Making it global
oh snap cont is not defined 😮
Uhhh
is not global*
He then tells the subrutine on_ready to make the idd global
Essentially what I did
Any var outside a subroutine in python is global by defualt
And what ever he's doing is unassigning idd
I may look dumb but I'm not that dumb 
Because global idd should not work if it's already been assigned

just tried ```python
try:
server = client.get_guild(632649478288965703)
except Exception as EEE:
still the same error, i can assure that $idd is not the issue
Would you mind doing await client.wait_until_ready() on the first line of the function on_ready
no prob, trying now 🙂
it passed but unfortunately its not the issue 😢 thank you though!
Is your idd variable for user ID or server ID
What are you even trying Todo with the guild object
its a lazy attempt to create an api that fetches user/guild info, simply by supplying user/guild id's. For private use only as that would be against tos to create a public api hook
Why does that need to be on_ready then
tbh it doesn't, my next move is to take a lower level approach. Not too big of a deal as we currently use php for discord 0auth2 and its worked decent
Have you tried logging idd and its type right before get_guild
When in doubt slap a print statement
yes 🙂 printed directly before/after and both came back as expected
Which is?
idd = 632649478288965703 # for testing
always returned as such
i even tried client.get_guild(632649478288965703)
Which gives you and error?
yea there seems to be a low-level issue somewhere else
Personally I don't get why it needs to be in on_ready
Saying that it should still work
no you're absolutely right, client.run isnt good for 1 shot scripts, it shouldn't even involve a loop tbh
no thats fine that works as it should
im trying to make array inside array is it possible, because im working w queue system and if (songs_q.find(msg.guild.id)) boolStat = true; it says TypeError: 264445053596991498 is not a function
and i tried with has but then it said has is not function.
defining line: let songs_q = [];
(in js)
Find takes a query function.
<Array>.find(element => element === "query")
"query" would be msg.guild.id
if (message.content.includes(message.mentions.users.first())) {
let mentioned = client.afk.get(message.mentions.users.first().id);
if (mentioned) message.channel.send(new Discord.RichEmbed()
.setTitle(`${mentioned.usertag} is currently afk.`)
.setDescription(mentioned.reason)
.setColor("BLURPLE"));
}```
Is there anything wrong with this?
what is client.afk
A map, collection and or some kind of sqlite db by its looks.
no client.afk is a map in this situation
As far as regex is involved it doesn’t matter if I just take and exec user entered regex correct?
Like is there anything I have to worry about that’ll screw up my server or nothing like that?
(And yes after ensuring that the regex is actually valid)
it does matter.
a malicious regex can kill your bot
or maybe even your whole virtual machine if you havent set memory/cpu limits
its one of the many attacks i have had to put checks in for within duktape in my own bot
It's called ReDoS or something.
you can do things like malicious backreferences
yeah
The regular expression denial of service (ReDoS)
is an algorithmic complexity attack that produces a denial-of-service by providing a regular expression that takes a very long time to evaluate. The attack exploits the fact that most regular expression implementations have exp...
read those and understand them and your bot will be a ton more secure @slim heart
Is there a package or something I can just use to ensure it’s nothing bad lol
I’m going to be adding a premium feature to my censor bot that accepted regex in server filter
It’ll be a big helpful addition
Make your own "regex".
Yes
@slim heart if youre in full control of the interpreter of the regex you can put a timeout on its loop
thats what i was able to do, usually in js itself you cant do that
if you'd like to brainstorm ideas, i think you and i are writing similar things
@amber fractal close to 300 people have asked for it. It’s not like they’re all gonna be regex masters coming into it however the amount of customization that comes with it would be amazing, because regex is really simple to just look up what u need with it. Like it’ll take 2 seconds for a normal user to figure out how to add a .
And then they can use it
the risk is from people who dont know what theyre doing
you can learn regex but making a bot is much more complex lol
not actively malicious, although theyre a threat too
its too easy to accidentally write an evil regex
like (a+)*{50}
that'd kill your bot stuck at 100% cpu the first time someone says "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaah!"
that gets worse if you try and separate it into a thread
because that thread gets stuck, and then they start another... and another...
i had to submit a pr to the people who made the js interpreter i use to prevent the problem
basically this https://github.com/svaarala/duktape/pull/2199
Not too sure really
@earnest phoenix why are you checking if the message content includes the mention?
I'm pretty sure that would call toString() on the user object
Which in discord.js would be the mention in the form of <@userid>
Which in discord.js would be the mention in the form of <@userid>
Which in discord.js would be the mention in the form of <@userid>
Which means your code probably won't work if the user has a nickname because those mentions show up as !@userid or <@!userid> , don't know anymore.
Anyway, that check is pointless?
Just check if there's a mention or not.
Just check if there's a mention or not.
What do you mean by “Which means your code probably won't work if the user has a nickname because those mentions show up as !@userid or <@!userid> , don't know anymore.”
@compact oriole A bot isnt really complex. In fact, I can make a bot turn on in like 5 minutes I still don't know everything I can do with regex
With configurable regex checks and moderation
Lol
No-one can
And a web dashboard
I said make it turn on
Then checking message content against a filter is also simple.
Yea, but turning it on doesnt accomplish the regex stuff
Can you change the filter automatically
For any server
That has nothing to do. With anything
If you want to change the regex, can your 5 minute bot do it?
Maybe they never have coded
They would have to learn coding
If people pay for a regex addition, then making their own bot specifically for their server then it takes a lot less time
I said nothing about what his bot can and cant do
Im saying making a bot is easier than regex
But you said "WhY cOuLdNt yOu JuSt CoDe YoUr OwN bOt"
and no it isnt
learning coding, js, discordjs and regex combined > regex
btw what regex stands for? (lol, i dont rly know)
Regular expression
kk
Its complicated when you have never coded
You don't need anything advanced to check against a filter
Why would people with 0 coding skills make a bot
When they could use his regex thing
And regex is mpre complicated of you've never used it.
Because it's literally saving money.
Lol ur delusional
js is complicated, if you want professional bot.
Learning a new skill like coding isnt that efficent
js is easy, if copy paste.
Just pay the premium and thats it
What do you mean it isnt efficient
Prigrammers make super high pats and are in high demand
It's one of the most efficient career paths
Its easier to pay a small fine than learn tens of hours to code
Everybody doesnt know how to code
And it's almost entirely self teachable.
It doesnt happen in hours lol
So learn, save money, and make money
You open so many options when you.learn skills.
And it will be way worth it in the long run
I never had js lessons xD (it took 1y and 2m to fully understood js)
But why would someone want to learn a skill for one simple thing
if it's one simple thing why not
When you can have it better
Actually, it isnt simple, when you start making advenced things for your bot.
but until that, it is simple.
It isnt simple to learn to code
it's really not that hard honestly
Scratch is easy, theres a reason it cant do that much
once you grasp the basic concepts it gets so much easier
and people that want to code should be willing to do that
Its actually pretty easy to understand coding language, if you had ever coded w another lang than js. (not visual lang)
it's easy to understand what's going on with any basic programming knowledge
will understand everything it's doing? probably not
but you can follow along
I was just trying to argue that paying for a regex addition to a filter isn't worth the simplicity of learning to make your own bot (only with the capability of checking against a filter nothing else) with the regex filtering capability.
(you can use google too)
I agree @amber fractal
there we go, ive altered my description to tell people about the special perk they get on the support guild by voting
if only the system i made for that was more generic, i'd be happy to share it
@amber fractal the way my bot work is really efficient and really effective as well. I’d argue it’s likely better but also like there’s other features that’d be complicated if not dumb to try and implement into another separate bot. Hosting is another issue. I don’t think it’s really fair to say that just because a feature is niche or complicated that it just shouldn’t be added lmao
@slim heart are you going down the customisable behaviour route too?
@green kestrel I honestly don’t know what to do. I’m not even able to reproduce a catastrophic backtrack as claimed
its a thing, best thing to do is avoid letting users do regexes
unless you can be sure you can set a time limit and ram limit on them
Again i can’t even reproduce a ReDoS
what language are you using?
Js
Like I tried the (a+)+ on a bunch of a’s with a ! At the end and it just returns as expected
I just get [“”, “”]
ok, sec
I’m trying a bunch of other ones on the wiki and long ones take a few milliseconds longer but it just returns null
if (/^([a-zA-Z0-9]+\s?)+$/.test("no u aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!") && /^([a-zA-Z0-9]+\s?)+$/.test("no u aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!") && /^([a-zA-Z0-9]+\s?)+$/.test("no u aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!") && /^([a-zA-Z0-9]+\s?)+$/.test("no u aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!")){
console.log("looped");
}```
i think that may work.
without proper limits in place, that can kill my bot
each one takes several seconds to execute
someone put it into a js handler on message create to see what would happen, only difference was they had the constants as message.content, and console.log as a create_message
I mean that wouldn’t be a realistic scenario would it
in my case yes it can be
i dont just allow regexes, i allow custom code
so, someone literally put that in there
I loop through every thing in an array make it a regex and match it against a single word
Plan would be to allow them to enter in their own regex and it’d just add it to the array
I didn't say it was bad or ineffective, it isn't; it's more features. However, I said I don't understand why anyone would pay
4 separate regex checks in a single if 
heyo what to do at "client" in js const dbl = new DBL('Your top.gg token', client);
passing in your discord client
ok
or ignore that if you don't want dblapi.js to post your server count automatically
well, they should update the example on the docs then with 'client id'
it's not tho
client of this?http://prntscr.com/q779t6
np
no
your client object the main discord client
the client you are logging in with
client token? cuz im new to this thing
where can i find it
you have a line somewhere with const botorsomething = new Discord.Client()
What are you using to sign into Discord through your bot
whatever you have instead of botorsomething, pass that variable
no
We're off to a great start, gentlemen
thenw hat
Show your code
Then it's client
show the error
And you have to make sure it's in scope.
and what is the error you are getting
im sending
it's not that hard
it is with bad internet
then how are you sending messages now
could've just copy and pasted the error
its on a alternative laptop/pc
Cant use client before it's defined
Define dbl after client
later on but bad internet
move the const dbl line below the const client line
You cant use client before it exists
@surreal sage btw why u censor ffmpeg and fs?
idk
they censored their token
*** i like to ****
You only need to censor your token, and some important things/passwords, not modules.
- If you're complaining about bad internet, why not get better one? :D
because not everyone can afford it?
Hmm... true
we did it
we buyed
we had to wait some months
dutch so its dutch
it shal be last month but "no"
buyed = bought, shal = shall
ok i hate these words
How to create a IGN webhook so that it posts in a discord channel?
how do i make the Buttons and background like this?https://tayron.is-inside.me/kJv5AuNn.png
css
^
When I wan't my bot to send an animated emoji is it the same way to do it with a non animated one?
oh okay, thx
:200iq:
Oh god my page looks like hot garbage in dark mode
Same
Is there a selector or something for it?
I want to make a music bot. How to do that? (tutorials sucks)
What language?
js
Idrk js, sorry
is there any ratelimit to adding reactions to messages?
ok
TheNoob don't trust the pinned message for ratelimit times
Discord can change the time whenever they want; they recommend your library handles ratelimits
if you want to pause, maybe give it 2 seconds
one request per second has worked with me for everything so far
So 1-1.5 delay might be good
How to do a 2x2 field field when doing embed. Here's my code: ```python
def embed_start(self, user, msgid):
data = self.bj[msgid]
embed = discord.Embed(
title="BlackJack", color=14629377)
embed.set_thumbnail(url=self.bot.user.avatar_url)
embed.add_field(name="How to Play", value="In order in to win, you have to get 21 or less.......................................... ", inline=False)
mycards_string = self.get_cards_string(data[2])
botcards_string = self.get_cards_string(data[3])
embed.add_field(name="{}'s Cards".format(user.display_name), value=mycards_string, inline=True)
embed.add_field(name="{}'s Score".format(user.display_name), value="**{}**".format(data[4][1]), inline=True)
#embed.add_field(name="How to Play", value="In order in to win, you have to get 21 or less. ", inline=False)
#embed.remove_field(3)
embed.add_field(name="Opponent Cards", value=botcards_string, inline=False)
embed.add_field(name="Opponent Score", value="**{}**".format(data[4][1]), inline=True)
return embed
I'm trying to get the opponent score on one row, and the players score on another.
you cant really
well you can, but it wont be consistent
as not all people will see the embed have inlins
wait
stupid me
sorry
add a blank field after p1's score that isnt inline
then make opponent's cards inline
along with score
Yes
But it's blackjack
Meaning the opponent would be the dealer
Also, if you use the blank field method up above.. The blank field will still be there as in it'll take up space, there'll be a huge gap between your 2 lines of fields
It still won't look great
Just, dont use inline.
Not using inline fields 🤢
Sometimes they can look good (e.g. displaying small info) but too compact.
any errors?
firstly firmat your cide
- make message.content to message.startsWith
- wrongly used embed
.addField needs to be used in like this .addField(name, value, inline?)
message.startsWith would be incorrect
you call it on .content, not the message itself
Adding a value is optional i believe. It's set to undefined to my knowledge
The problem is you don't actually pass a function for the 2nd arg of the listener
Notice how it's closed after the "message" string for the .on method.
value is not optional
It's optional for me, but I don't know if that's a difference in versions as I'm on master. All I remember them changing is the name.
still not optional on master 
They re-assign it with Util.resolveString. If no value is passed, it returns "undefined". Only an empty string will throw as the string's contents is "undefined".
Anyway that's not the point of this
is it normal that the code of this embed works on my servers but not on discord bot list? please mention me if you have a solution
.setAuthor(message.guild.owner.user.tag, message.guild.owner.user.avatarURL)
.setTitle("Information à propos du serveur")
.setThumbnail(bot.user.avatarURL)
.setColor('#' + Math.floor(Math.random() * 16777215).toString(16))
.addField("Nom du serveur", message.guild.name)
.addField("Nombre de membres sur le serveur", message.guild.memberCount)
.addField("Nombres de bots", message.guild.members.filter(member => member.user.bot).size)
.addField("Nombres de personnes connecté (hors bots)", message.guild.members.filter(member => !member.user.bot && member.presence.status === 'online' || member.presence.status === 'dnd' || member.presence.status === 'idle').size)
.addBlankField()
.addField("Propriétaire du serveur", message.guild.owner.user.tag)
.addField("Date de création du serveur", createdDate)
Larger servers may different conditions like uncached users (e.g. server owner is null/undefined).
the lines that pose problems are the 1st and the last
Are you getting an error?
yes the error is Cannot read property 'user' of undefined
what does it mean cached users? @sudden geyser
Users you have saved in your collections
for example: If you evaluated the member count with message.guild.members.size and message.guild.memberCount, they'd likely be different if you don't fetch all users.
and how fetch all users ?? like the owner of the server for example
you can enable fetchAllMembers in your client options
but keep in mind that this will increase memory usage and startup time
Most libs have a function to download all members for a certain guild too
it's not a problem
Or just fetch the owner if that's all you need
or you could use the fetch method to get a single member which is faster (depends on if your'e on master or stable)
me too slow 
@quartz kindle have you got an example to enable fetchAllMembers in the client options ??
Read the docs
you know how you initialize the client?
let client = new Discord.Client()
you can add options to it
Client({option:value})
ah ok i didn't know
this is the list of options you can add on djs v11
the client option is to enable caching all members
which means, all servers and all users and all members will always be cached
else the bot will only cache users who are online
but you can manually cache users when you need them
using fetchMember or fetchUser (in v11)
yes
oh ok thanks
if i put the fetchAllMembers option in the client, will i need to change the embed or not?
no
i change the embeds only if i use the fetchUser ?
yes
ok thank you very much
*help
ok
howtodoascriptsoachatgetssyncedtoaotherserverwithwebhook
learn to use a space bar then ask
^
donotdothatyou'llgetratelimited
.....
If you are really set on doing this
webhooks are incapable of receiving messages
^
a bot can
sigh
thats not a webhook
but you said a webhook
learn how to ask questions
^
im Dutch stfu
id advise learning what webhooks and api's r first
a webhook is not a bot and a bot is not a webhook, however a bot can create a webhook
r
cuz seems to me you want to make a bot webhook with a bot?
that's not how it works
webhooks are isolated, a thing of their own
ok...... 👃
what
thats a nose
i'm aware
what's the point of it being there
i think that's what you need
lol
i believe you use discord.js
@earnest phoenix stop randomly staring every little thing
i jk
that method returns a promise so resolve that and use Webhook#send
what you're probably thinking of doing is getting a message through a bot's event and then piping it through a webhook, however a bot can't make a webhook say something, you have a webhook client of it's own that'll help you do that
since webhooks are linked to only one channel, you can directly make a request to the api with its id and token and it will send a message to that channel
but bot != webhook
be warned that having two different text channels linked and piping messages through only one bot/webhook will often lead to a ratelimit
that's kinda misleading, afaik many discord libs let you execute webhooks via bot context, theres not that much difference as its just another API request though not authenticated with your bot's token
uh
far from needing a separate "webhook client"
well
no
every lib is indeed different
but the native and only possible way is to make a request to the endpoint with your webhook's id and token
which, if some libs let you execute webhooks from a bot, they do exactly that in the background
via discord.js you simply get a webhook object and call send on it as if it were a channel or user
just saying that specifying "a bot can't make a webhook say something" is a bit misleading as from the devs perspective they do exactly that in a one-liner
!invite
at fault? that seems excessive
and discord.js does a lot of things for the end user because most of the userbase are 9 year olds who can't comprehend with multiplying
right, well i use eris which has just a client.executeWebhook
it's pretty much the same from my perspective
again, every lib is indeed different
but a bot doesn't execute the webhook
saying that it can is incorrect
a bot user doesn't, but a bot user doesn't do anything
the "bot" is the program controlling the bot user
so really a bot totally does execute the webhook if we're being pedantic
the only thing you do with your bot is get the webhooks, when you get your webhooks you have the access to its id and token, which means you can make requests with the webhook
!link
lmao still
yeh, that's all true, just again think it's not a useful distinction to make nor is it helpful to the user seeking to do that with discord.js
at best you can specify "you may think to receive a message and send it to the webhook and you can do exactly that it just won't be authenticated with the bot token" which doesn't really throw any wrenches into the original plan lol
So I have a line of code which is a command but it breaks the code when I try doing the command can someone help? https://paste.mod.gg/bicunicuji.js
this is what happens when you copy and paste code
I didn't copy and paste
are you getting any errors?
Well the log shows a bunch of stuff when I try the command want to see it?
i do not believe that you went through and commented on every part of the code with instructions on whats going on
yeah I looked through it, that's copy pasted from a tutorial iirc
it is commented a lot
@modest maple I can share my screen if you want to see what it says
found it
lmao
specifically
he's writing a new client.on message for each command
So before I run the command it says this
Promise { <pending> }
Bot has started, with 120 users, in 86 channels of 2 guilds.
yes
and after I run the code
command is not defined
yes
learn basic js before trying to make a bot in js please
Reading the docs helped me
Look I just need help with separating the damn commands
LEARN JS FIRST
Yes or no
help yourself by learning js
then come back to us
they dont
I know they copied pasted
and maybe if you didnt copy and paste
you wouldnt have this issue
cuz you would understand your own code
If you are going to copy and paste which I dont recommend actually read through the code and see how it works
not trying to understand someone else's way of coding
@earnest phoenix Well maybe if my school had a damn coding class I wouldn't even be in this damn server
well why are you attempting to make a bot with a language that you don't even know ?
you wouldnt have this issue
start with something more basic than a bot
^
i don't think it's a school's fault, how would they know people want to make a discord bot?
I hate to tell you but my school is the smallest school in the damn state
plus your online right now, just watch some tutorials or read through some docs
You can always look at examples but don't copy paste
you don't need your school to have a class on it, there are an amazing number of tutorials and resources online
then my dumbass cousin who codes doesn't even help me
I'd venture to guess most of us are self taught
just seek out some good js tutorials and learn at least the basics
Most of us are self taught
Yeah i self taught everything ever
it's usually Java and c++
well HTML and CSS is taught in my school
in my experience
I mean this is from Britain
im self taught
we have electives in our school, python, c++, c# or php
I learned how to code in 6th grade using python but that didn't do shit
python does everything
Python is pretty similar to js
it really isn't Runi
it's not
things ive done in python:
sorry lmao not in syntax
i learned to code in 5thgrade and created my own bot that failed horribly without any command handlers
js
they are the top two interpreted languages though imo
very similar in features and such
@empty owl I think everyones first project kind of fails lmao
Website
Mobile App
Discord Bot
High Speed file handler
Webscraper
Q Learning AI
MENACE Machine learning
lmao
countless games in python aswell
like
python does alot
theres pretty much always a module for somthing

Ya know what since I'm not getting any help I'll just use my other 2 bots that have a say command
see ya
anyway Zach if you truly know Python then you should know you can't use variables that haven't been defined
cya
if that's not enough then go learn more
interpreted languages are often avoided in game deving
yh
people are helping you, you can choose to accept our help and take initiative to actually learn the language or continue copy and pasting
how does he have a say command
CUZ HE JUST COPY AND PASTED IT
and tbf
you can use pygame with Kivy to make an EXE
i mean you have DDLC as an example for a game in py but that's just a visual novel
cpp
scripting language for a game is fine if you're scripting an engine




