#development
1 messages · Page 661 of 1
guys who write bot on Python, also know the game minecraft, help pliz
A little of both, what's your question? @earnest phoenix
I want to do to chat minecraft automatically was copied in chat discordъ
@hybrid ruin
Made in Java, perhaps take inspiration from there
I don't know py well enough to help nor spoonfeed you
One message removed from a suspended account.
does this happen when a user hasn't even touched the economy and they do the balance command?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
?help
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
yeah I wasn't sure that would work with your case
I added it to my bot when the user was 0 and it said null
and it worked for me
Why is there an object newGold that’s being defined bet never referenced
Lol vysion your condition would set gold to 0 if it’s not null
^
newGold is created but never used, so no new entry is ever created in the database, it will keep getting empty values
It looks like you want to replace const newGold with gold
So the new gold object is actually stored by gold instead of newGold
how to get icon server with api ?
what library?
REST API is GET /guilds/{guild.id} and the icon field will have the icon hash
js @tranquil drum
do you mean the actual discord api or djs
d.js: Guild#iconURL
^
What is code for making the bot join vc in JavaScript
Yeah trying to make a bot that I can control
I wanna see if I can make it appear to be sentient.
Can I have help with that?
How can I check if someone has voted for my bot in the last 12 hours? I’ve tried googling and such but I can’t really find much. I know checking who voted in the last 24 hours is documented, but what about 12?
@near ether doesn't the vote endpoint return the time a user voted?
@earnest phoenix what languages do you use?
Also I think it's better to ask in #topgg-api neelio
How do I make the backround of my bot page have this image: https://img.freepik.com/free-vector/light-rays-background_23-2147504702.jpg?size=338&ext=jpg
css
how
@earnest phoenix google how to set a background image with css
I did
<style>
body, html {
height: 100%;
margin: 0;
}
.bg {
/* The image used */
background-image: url("https://img.freepik.com/free-vector/light-rays-background_23-2147504702.jpg?size=338&ext=jpg");
/* Full height */
height: 100%;
/* Center and scale the image nicely */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
</style>
lol
is that an embed I saw
Yes.
@sage bobcat Don't know if you managed to get it working already but another issue I see that no one else has mentioned yet is that you're searching for a Gold document with the userID property, while the ones you're adding have userId
Change .bg with whatever class you want to have the background
In your case maybe change it to body idk
change it to .bg to body
body without .
so
uh
those who use lavalink
how do you know which bands to edit for your audio effects
One message removed from a suspended account.
One message removed from a suspended account.
if(message.author.bot) return;
var content = message.content;
if(!content.startsWith(botconfig.prefix)) return;
var args = content.split(' ');
switch([args[0]]) {
case 'ct!help':
if(message.author.id == message.guild.owner.id) message.channel.send(HELPembed);
else {
message.author.send(HELPembed);
}
break;
}
}
)```
anyone have any idea why this isn't working?
discord.js
switch([args[0]])
you're switching over an array containing the first element of args
so what do I need to do to make it a string
Hello! 👋🏻 does anyone know how to make a connection from website to a discord bot? So it’s like you get a code from the website and then you write !verify (code) and gives you a role? Please ping me if you know
insert the verification code in a db or some data source that the bot can read and you should be good
bot looks at the data source for the verification code and if it sees it, it gives the role and makes sure the verification code can't be used again?
Uhum... I will try.
How would that feature help verify users anyways
Does anyone know a npm package that would get system information on the bot? Like CPU Usage, Mem usage, etc
so i have this function here
function ConfigureChild(Parent) {
Parent.child.on('close',(c,s)=>{Parent.onClose(c,s)});
Parent.child.on('message',(m)=>{Parent.onMessage(m)});
Parent.child.on('error',(e)=>{Parent.onError(e)});
Parent.child.stdout.on('data',(d)=>{Parent.onStdout(d)});
Parent.child.stderr.on('data',(d)=>{Parent.onStderr(d)});
}```
Which configures a child process to send its stdout and stderr to a certain function on the parent object. This works great for processes that i spawn with child_process.fork and set to an ipc.
I am trying to set it up for my bot shards, and by default the sharding manager sets the pipes to inherit, not ipc, which makes this code not work, because Parent.child.stdout is undefined. How can i tell the sharding manager to change its settings when spawning the process?
End goal: capture stdout and stderr of shards
(ping me if answer)
Anyone help with discord.js?
I want an embed that takes the color of the message.author or the mentioned user
get the hoisted roles color
like message.guild.me.DisplayHexColor but for someone
stop trolling
my dad works at discord
he can ban you >:((((

I am trying to convert os.uptime() into the format 00:00:00 (hour, min, sec) using moment
but when I try I just get 00:00:00
and the bot has been online for like 10m now
https://nodejs.org/api/os.html#os_os_uptime (what I am using)
what I am doing:
let os = require("os")
let moment = require("moment")
message.channel.send(moment(os.uptime).format("HH:mm:ss")
Oh wait
Nvm 😅
I forgot to put () after uptime
forgot uptime was a method
@fathom meadow There probably a tutorial on the web. If not, just use a bot that already does this.
how does a full eval command?
eval()
Henlo quick question:
let prefix;
Server.findOne({serverID: message.guild.id}, (err, server) => {
if(err) console.log(err);
prefix = server.prefix;
});
console.log(prefix);
I'm trying to declare the var prefix through that but whenever I log it outside, it returns undefined although when console.log(prefix) is placed inside of Server.findOne()... it returns the correct prefix. Any help is appreciated, thank you! (I might be doing something unbelievably stupid sorry lol)
You haven't defined the prefix yet
@fathom meadow hi good sir, while it may look like console.log(prefix) is executed after everything else, it's probably not the case, as findOne() is asynchronous and your code assigning the prefix is only executed when called back
so basically, console.log() is executed before your assignment
that's also why it returns the correct data when you place it inside 
oh
to make it work as intended, you can just put the relevant code inside the callback
do I have to await for prefix?
he left
or await findOne() if its possible (as in, if a promise is returned)
await worked, thanks!
It's mongoose
MongoDB*
Mongoose is the lib im using for everything
that's good, all mongoose methods return a promise, so you can await everything and avoid the confusing callbacks issues
thank you paradox
pawadowo
you're welcome, i once fell into the callback hell before as well, so im more than happy to help others getting out of it :)
when can't you use a try catch command in discord.js?
so how do you actually record voice in a vc
like is there some sort of trick or event or what
Yes there's usually an event where you receive raw PCM data that you can store
would you know what it'd be in discord.js master
Dont believe you can yet
But you could probably make it yourself, if you know how... Which I dont 
I think jda can 
And then use 90% more ram and cpu 
alright how do you reference the GNU GPL v3 license in the package file?
is it something like gpl
@earnest phoenix we don't spoon feed here.
ok
How to make can ignore the number of users? On this server?
is there a website that helps people who don't know how to make a bot? if there is tell me pls because I have no idea how to make a bot
the library docs
and the language docs
oh thxs
@rocky fable what language and what library ?
just grab the actual number minus this guild's membercount
How can I remove user reaction from message ( Only one user reaction )
When I am using message.reactions.remove(user) it sends me Unhandled Rejection TypeError: message.reactions.remove is not a function at Client.<anonymous> (./bot.js:328:21) at processTicksAndRejections (internal/process/task_queues.js:85:5)
discord.js?
yes
k one sec
.reactions is a collection youl need to call the .remove on the reaction object within
if its not too difficult to explain whats the best way to make a command cooldown in js
you can store the last time the command was run successfully and check if enough time has passed
ahh okay thanks
store in cache uwu, like use a set() or map()
hi so uh, can you somehow select an element in jquery through what it's set as
like this
oh like what the text inside of it is
yeah
it's the only way i see of selecting it as it's just a p element with no id or class
and jquery could pick that up?
ya
if it uses regular css selectors yes
its a valid css selector query
alright
@earnest phoenix please don't send irrelevant messages in here ty 
also document.querySelector() would work too
if you do need to search by inner text tho check out this stackoverflow question https://stackoverflow.com/questions/37098405/javascript-queryselector-find-div-by-innertext
what are you trying to do lol
you can def select it with the query Natan posted document.querySelector('.left-container > .column > p')
its a different element but if you do any calls on the result of that query you're going to do that for all elements that match that query
lol
$('.left-container > .column > p').first() maybe
i dont use jquery very often,
if you're just changing text tho you could do document.querySelector('.left-container > .column > p').innerText = 'blah blah';

Is there a way to remove all the spaces/blanks in a string in JS?
@earnest phoenix if you have access to regex: str.replace(/ /g, '');
does anyone here (who is experienced with mysql and node.js/discordjs) have a few moments to give me a hand with something? ping or dm me ♥
@frozen granite What is that thing you require help with?
you dont have discord.js 
i'm sorry I have no idea
when i try to instlal it in the full page console
idk if this some private info
so
im not gonna try to show it here
if anyone is trusted
or is a moderator of discord bot list
pls help
Hi all! I get an error when trying to start my Discord bot (I was programming using another shards bot and it didn't give any problem, today I changed the token to pass it to the original version and it gives me this error)
at Shard.once (/var/www/html/Filo/node_modules/discord.js/src/sharding/Shard.js:88:39)
at Object.onceWrapper (events.js:315:30)
at emitOne (events.js:116:13)
at Shard.emit (events.js:211:7)
at Shard._handleExit (/var/www/html/Filo/node_modules/discord.js/src/sharding/Shard.js:272:10)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)```
remove shard ;-;
Just to be sure:
class something{
constructor(){
this.ok;
}
}
class oof extends something {
constructor(){
super.ok = “ko”;
}
test(){
return super.ok;
}
}
Does oof.test() returns “ko”?
whut?
I tried to remove this part of my code and it stopped giving error
setTimeout(() => {
console.log("\r\n\r\n\r\n\x1b[30m[\x1b[33m⚠\x1b[30m]", "\x1b[0m[Sistema]", "\x1b[0mTodos los sistemas van a reiniciarse en unos instantes.\r\n\r\n\r\n")
manager.broadcastEval("process.exit()");
}, 2678000000);```
Is it for having put too many milliseconds?
I sometimes get that error too and it’ll be gone after i restart the project
for some reason
The thing is that the error returns to me when restarting and before I did not
Thanks also ^^

@earnest phoenix
class Something {
constructor() {
this.ok;
}
}
class Oof extends Something {
constructor() {
super.ok = "ko";
}
test() {
return super.ok;
}
static get test() {
return super.ok // Will be undefined.
}
}
Oof.test // Return undefined
let test = new Oof().test(); // Will call the test function.
except it doesnt work @warm marsh
Explain?
isn't it super()
however properties of Something are accessible in Oof under this
also why do you define test() twice @warm marsh
this will work as intended
class Something {
constructor() {
this.ok = "ko";
}
}
class Oof extends Something {
constructor() {
super()
}
test() {
return this.ok;
}
}
console.log(Oof.test) // Return undefined
let test = new Oof().test() // Will call the test function.
console.log(test)
Yes
@earnest phoenix you cant modify properties of super, however properties of super are available under this
yes
super properties are modified using super methods
Pretty sure that works
And kind of makes sense ig
or you could modify this.<supers property>
Hi all! Sorry if I bother
I have the following code to check if my bot has permissions to send messages:
if (!message.guild.me.hasPermission("SEND_MESSAGES")) return;
The problem is that if they have another role that denies these permissions it gives me a permission error in the console, how can I solve this? (I have the permission check in the message event)
@twin kestrel Check channel permissions, that's the only issue 
so in message listener check message channel permissions overwrites and all
Okay, i try
How to make can ignore the number of users on this DBL server?
node.js
wat
he wants his bot to ignore the amount of users in this server
???WTF
take the length of bot.members and then subtract the length of get_guild(264445053596991498) (members)
in py: len(bot.get_all_members()) - len(bot.get_guild(264445053596991498).members)
@rocky fable which lib
Works in both discord.js and eris:```js
bot.users.size - bot.guilds.get("264445053596991498").memberCount
const Discord = require("discord.js");
const botconfig = require("../../config.json");
const { RichEmbed } = require("discord.js");
module.exports = {
config: {
name: "userinfo",
Description: "Zeigt dir Infos von einem User",
accessableby: "User",
aliases: ["ui"]
},
run: async (bot, message, args) => {
if(message.author.id !== botconfig.OwnerID) return;
let user = message.mentions.users.first() || message.author;
let Muser = message.mentions.members.first() || message.guild.members.get(args[0]);
let userinfo = new Discord.RichEmbed()
.setAuthor(message.author.username)
.setColor("RANDOM")
.addField("Username", `${Muser.user.username}#${Muser.user.discriminator}`, true)
.addField("Status", user.presence.status,true)
.addField("ID", `${Muser.user.id}`)
.addField("acc erstellt am", `${Muser.user.createdAt}`, true)
.addField("Höchste rolle", `${Muser.highestRole}`, true)
.setThumbnail(Muser.avatarURL)
message.channel.send(userinfo);
}}```
why `.setThumbnail` dosen´t work ?
everything works in the embed aside from the thumbnail?
👀
If the user doesn't have one it won't show
could always just add a log statement to ensure that it contains the correct value
missing semicolon wouldnt do it either would it?
@coarse vapor and ? did you test it ?
i use dpy
but i have seen that the difference between ?string and string can be an issue in some languages
nullable i guess
hmm
[reading the docs of a language i dont even use... very fun]
How i found out:
> .mentions
> MessageMentions
> .members
> COLLECTION: Snowflake, >>GuildMember<<
> GuildMember.avatarURL doesnt actually exist
```
@opaque eagle that will likely return a negative value lul
w0t
users is obtained from guildmembers
it will only cache according to cached members
afaik
well it didnt return negative, but still a wrong number
Hey
so for python
The example shows the module dpl
dbl*
whats the package name
Dblpy I believe
Where r u evaling that @quartz kindle
nw.js console
oh
https://hastebin.com/xamababefa.js
it dont switch the page
(no its not copy n Paste)
not sure if this is the issue but ◀ is different from ⬅
looks like the filters are filtering for different emojis
come #265156322012561408
@bot.command()
@commands.has_permissions(Kick_Members=True)
async def kick(ctx, member: discord.Member=None):
if not member:
await ctx.send('''**Nope**
*Use:* ***`"kick @someone`***''')
return
await member.kick()
await ctx.send(f'{member.mention} has been kicked!')
it tell me I don't have the kick members permission but I have it, pls help
does the bot have the permission?
kick_members
thanks
Capitalization matters
can you use md in embed footer?
md?
Markdown and no
Ah
ok thanks
@bot.event
async def on_member_join(member):
if guild.id == 578548442687864832:
is there any way to do that if guild.id? (I know this is wrong)
the member object has a guild
member, guild?
member variable, being instance of discord.Member, has a property guild
Would there be a way that I can use Express.JS variables to an external HTML file? Like instead of me making EJS files I use html, css, etc. But my server.js file has a variable that I want to pass to an external HTML file. Is that possible?
read html file using fs
.replace()
send fs read as text
// express async .get() =>
const html = await fs.readFileSync(path, "utf8");
html.replace(/{variable_name}/gi, "new value");
res.send(html);
that's how i did it, IIRC
<div>{variable_name}</div>
after parsing it would be
<div>new value</div>
(following from the example)
Ah gotcha
@abstract crow why not use something like ejs instead?
Ejs bad
^
Since when? 
is it possible to make a custom rpc for a program that doesn't have one?
Isnt that what prople did with things like vscode?
i guess so
but how is what i want to know
i wanna add rpc to my art program, medibang! paint pro
@sick cloud
I mean if Discord can tell what programs you open, I don't see why you can't build a cli tool in the background that auto-starts RPC whenever u open that app u wanna make rpc for
Why not just add rpc to the program 
literally what i'm trying to do @scarlet phoenix??
That was a response to eslint
oh ok
Despite of my bot having the highest role in the hierarchy and admin perms, it's unable to change any roles' perms and returns ContextException instead, "Missing Permissions"
code where it's breaking?
I don't seem to get an error any more, but it's not showing anything in any audit logs
r.getManager().setPermissions(newRoleSettings).queue();```
`r` being a Role object, `newRoleSettings` being a long from a Role it's trying to copy settings from
In discord.js is there a way to get full user count (in all guilds) without bots.
filter out bots
yeah but how?
I found this code
client.guilds.members.filter(member => !member.user.bot).size;
but client.guilds.members returns undefined
Yes.
I don't think guilds has prop members
client.users.filter(user=> !user.bot).size;
or any other method of filtering you wish.
Guilds has a members property
<Guild> has I don't think <Guilds> does.
client.guilds returns <Guild>
or at least thats what the documentation says
returns a snowflake of all the guilds
client.guilds.reduce((prev, guild) => prev + guild.members.filter(member=> !member.user.bot).size, 0);
Yeah
oh wow okay I think im gonna go with the easier option lol
thanks tho
Lol
@warm marsh no spoonfeeding 
3 guilds
shard 9
math 100
There can be 3 guilds on that shard tho, no?
9 shards for 3 servers
or 3 guilds on the 9th shard
Maybe the presence is a lie 
or planning on making 1 shard per guild 
keep in mind about "performance" consideration on that code
on small scale, should be fine but on scaled applications 
sa
@sick cloud y u hatin
Hi, anyone familiar with discord.py, can you explain how I can use discord.Client.edit_channel_permissions() the api reference isn’t really clear on it
@halcyon nymph I cant find that in the discord.py library, but it would probably be something along the lines of await client.edit_channel_permission(perms)
Do you have the link to that section?
what is the best solution to "build" several javascript files in one?
cyber what do you mean
As the docs state:
await client.edit_channel_permissions(channel, target, overwrite=None)
Where channel is the channel to edit, target is the member/role to edit perms for, and overwrite being the perms
I'm surprised this isnt in the discord.py read the docs ref, which makes me wonder if this is actually from the old version which isnt supported now (v.0.16.x and lower)
Oh, looking at the link, it is from the unsupported version
@halcyon nymph edit_channel_permissions is no longer supported as the library has migrated to v1.0.0+ (most recent is 1.2.3)
@sudden geyser i want to have my code in multiple files (so i can maintain it more easily) but distribute 1 file at the end
@earnest phoenix Oh, is there a new way i can edit channel perms for a specific role?
Well it's kind of hard to understand how you specifically want them built, but just require the files within your main file while splitting them.
If you mean something like commands in separate files, you could use the fs module
The target parameter should either be a Member or a Role that belongs to the channel’s server.
I've looked at channel.edit, so you might want to look around there with the permission overwrites, but I cant be exactly sure as I haven't used it myself.
Though channel.edit only seems to have the sync permissions arg so idk
You both are looking at different versions
@sudden geyser require doesnt work when distributing for web iirc, but i would still prefer writing multiple files and distributing one
The target parameter should either be a Member or a Role that belongs to the channel’s server.
https://discordapp.com/channels/264445053596991498/272764566411149314/604281391458549772
I'm confused, because my version of discord.py definitely has edit_channel_permissions as a runnable command?
🤔
Yes
I just don't know how to use it
Did i hear python?
How are the docs not clear on this
not clear is shorthand for I can't find where it's mentioned at all
(channel, name=newname, permissions=permission.overwrite,
Not helping at all
I don't know anything about web stuff so I can't help you there 
If you aren't going to help with it, don't
Okay, i might've been on the wrong thing
It still works
Yep
You were on the wrong docs.
I did help, I wrote about it https://discordapp.com/channels/264445053596991498/272764566411149314/604283067452096512
So why keep mentioning that it's not "supported"
@earnest phoenix so... how do i specify permissions?
@halcyon nymph are you in the discord py server?
no
You might want to try there for help regarding the library in particular
Meaning if you need help with old stuff, you'll have to migrate to the new docs
👌
@slender thistle
The definition of "supported" was the problem here
It's outdated, not officially supported but still works
Whether you took it as one or the other, mine was still correct. It doesn't receive support and most of the code doesnt work
Which things for example don't work except from default channels?
Last time I used that version, bot.send_message stopped working at some point for me
Even though it works
All it really does is get .id from provided channel object and send whatever you tell it to
If things work for you, they might not work for others. Either way, if someone needs help its probably better to point them to the latest updated version that is supported, and that definitely does work, than providing support for an outdated version which might not even work for them
True about the last sentence, but not all errors are library's shit code, still. If we are talking about client.send_message from 0.16.12, it by itself does what it is meant to. If you don't provide it what it needs, that would be your fault
Though it wasnt
I asked for help in the d.py server when it happened, as it was only happening for one command at the time. Code was correct in the old version, but because of the library migrating, it just started breaking and wouldn't send the message.
The help I got was to migrate to avoid that happening to any other bot commands
Surely it's not the library's issue as I used async version for a while and it worked just fine
And since you were actually migrating, obviously there would be one issue or another, so if it didn't work for you, it's no surprise to me
No, at that point, I was using 0.16.12, I hadn't even heard of migrating. And it still stopped working. This was like, mid-June
Up until then, for 3 months or so, it was working decently
Last or this year?
This year
Let me actually test it 
To be safe I figured I might as well migrate. Idk if it works now, since I haven't used the old lib in over a month. But at that point, one command out of what I had just stopped working completely
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix='test ')
@bot.event
async def on_ready():
print(f'it works - {discord.__version__}')
@bot.command()
async def test():
await bot.say('It works!')
bot.run(token)
just tested and it works ¯_(ツ)_/¯
if its on rewrite it would be
@bot.command()
async def test(ctx):
await ctx.send('It works!')
Yes, but the topic was 0.16.12 version
ah
im looking to learn js to make a bot for my server, you guys got a preferred learning website? is w3schools good enough?
and google
cheers dude :)
tutorial, guide, documentation
thanks!
Not the full traceback
const keyv = new Keyv('./prefix.sqlite');
Err on this line
Err
throw new ERR_INVALID_ARG_TYPE(name, 'string', value);7:01 PM
^7:01 PM
7:01 PM
TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received type undefined7:01 PM
at validateString (internal/validators.js:125:11)7:01 PM
at Module.require (internal/modules/cjs/loader.js:632:3)7:01 PM
at require (internal/modules/cjs/helpers.js:22:18)7:01 PM
at loadStore (/rbd/pnpm-volume/db1ffd3b-edf4-4166-8949-e213164599e4/node_modules/keyv/src/index.js:18:15)7:01 PM
at new Keyv (/rbd/pnpm-volume/db1ffd3b-edf4-4166-8949-e213164599e4/node_modules/keyv/src/index.js:38:22)7:01 PM
Jump to
at Object.<anonymous> (/app/index.js:33:14)7:01 PM
at Module._compile (internal/modules/cjs/loader.js:701:30)7:01 PM
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)7:01 PM
at Module.load (internal/modules/cjs/loader.js:600:32)7:01 PM
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)```
const keyv = new Keyv('sqlite://path/to/db.sqlite')
It will also give same result
that's why java is fuckin gay
'The "id" argument must be of type string. Received type undefined'
@pallid zinc
Err has been changed
Ok
@client.event
async def on_message(message):
await client.process_commands(message)
Client Object has no attribute Command
Why?
Wrong part of code
Did they change member.addRole() in discord.js@12.0.0-dev?
That does it mean (node:13839) UnhandledPromiseRejectionWarning: Error: SQLITE_CANTOPEN: unable to open database file
@warm marsh yeah in v12 roles are now a GuildMemberRolesStore so to add a role would be member.roles.add()
Thanks!
Is there updated docs or something?
yes
...
@sudden geyser so i found exactly what i was looking for lol https://github.com/browserify/browserify
Why would you want that
so i can write code in multiple files (easier to maintain) and still distribute 1 file
but webpack
why should i use webpack over this tho
i like it since it can bundle your entire project not just js
webpack is cool
So I have an issue with my .awaitresponce script. For the most part it works.. however, now that the bot is in more servers, each server is over writing the .awaitresponce of the other servers, how can i set it up on a per server basis?
what does awaitresponse do?
show code
^
.then(() => {
message.channel.awaitMessages(response => response.content === 'test', {
max: 1,
time: 30000,
errors: ['time'],
})
.then((collected) => {
message.channel.send(`The collected message was: ${collected.first().content}`);
})
.catch(() => {
message.channel.send('There was no collected message that passed the filter within the time limit!');
});
});
For example
is message.channel being overridden?
where is message.channel defined
Was just wondering how I can make it so it doesn't if two or three servers trigger it
Just before it sends the message
can i see
@tranquil drum i mean, i only need to bundle js so i dont see why i would need it ¯_(ツ)_/¯
fair enough lol
PokeSpawn = client.getSpawn.get(message.guild.id); if (PokeSpawn) { channel = PokeSpawn.spawn_channel; } else channel = message.channel.id; embed = new Discord.RichEmbed() .setTitle(`A wild pokémon has appeared!`) .setDescription(`Guess the pokémon by typing its name.`) .setImage(`https://profoak.net/img/discord/pokemon/${Pokemon.id}.png`) .setFooter(`Guessing correctly will award your Starter Pokémon with ${RandomXp} XP`) .setColor(Type.color); client.channels.get(channel).send(embed) .then(() => { client.channels.get(channel).awaitMessages(response => response.content.toLowerCase() == Pokemon.name.toLowerCase(), { max: 1, time: 30000, errors: ['time'], })
oh my god why does it look like that
I'm on mobile

saves file size by emitting carriage returns poggers
im dipping
PokeSpawn = client.getSpawn.get(message.guild.id);
if (PokeSpawn) {
channel = PokeSpawn.spawn_channel;
} else channel = message.channel.id;
embed = new Discord.RichEmbed().setTitle(`A wild pokémon has appeared!`).setDescription(`Guess the pokémon by typing its name.`).setImage(`https://profoak.net/img/discord/pokemon/${Pokemon.id}.png`).setFooter(`Guessing correctly will award your Starter Pokémon with ${RandomXp} XP`).setColor(Type.color);
client.channels.get(channel).send(embed).then(() => {
client.channels.get(channel).awaitMessages(response => response.content.toLowerCase() == Pokemon.name.toLowerCase(), {
max: 1,
time: 30000,
errors: ['time'],
})
same code just formatted
For the mean time I've had to set a "global cooldown" using set() to prevent other servers from over riding it
whats the scope of this?
of channel
this is in some sort of message listener right
Yeah
idk lol you could try and store the actual channel object in a const or something
@old geyser is this the first time channel is defined?
if so, you're defining it in the global scope, so it will get overridden by every message
^
how can i make it send a webhook to my discord when someone votes
You would have to set up your own server for the discord bots webhooks and trigger the discord one from that
how about making it log to console when someone votes?
dbl.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});```
would that work?
yes
dbl.webhook.on 👀
it errors when i do that
dbl.webhook.on('vote', vote => {
TypeError: Cannot read property 'on' of undefined
well did you create a webhook?
i just want it to log to console when someone votes
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
assuming your machine/vps can receive connections on port 5000
so without using dbl.webhook.on i cannot log votes to console?
not in real time
but would what i posted above work?
dbl.on(vote) no, its not a thing
it wont work
dam
you're listening for an event that will never fire
what would be the best way to tell if a script tag has loaded and the code in there has executed?
i guess simply calling a function on the bottom of the file would work?
yeah basically
most of the time though, you shouldn't even need a function since the script will terminate itself at the end
Does someone know how I can give roles to a user when he is added in a guild with oauth guilds.join
?
if this is front end, you could listen for window.onload() but it's a wild guess
@Alex T.js#0001 you can specify an array of role IDs when creating the member
Is there anyway to have discord.js bot create a server?
@celest spear
Id just ask here
These people are smart
It’s possible but a bot can only create one if it’s on less than 10 guilds
and what Phoenix said.
.createGuild will is removed in d.js master
so you wont be able to use it once v12 drops
you can still just send the http request manually tho
or that
i dont see why they removed createGuild
v12 removes all methods/properties that can be used by selfbots
.createGuild was one of them
@mossy vine

i like to think that these are alts of dbl members just trolling us
Someone give them the hq life bot script
it sounds like he's trying to cheat a bot lmao
yeah
Bruh they just want the script
ah, why didnt we think of that
The secret AI sauce
W-w-w-w-w-windowwws
Linux is too simple
@client.event
async def on_message(message):
dm = 0
if message.content == '*dm':
while dm < 1001:
dm = (dm+1)
emb = discord.Embed(title=None, description=f'I sent you {dm} dms')
await message.author.send(content='HAHAHAHAHAHA 27th JULY HAHAH', embed=emb)
await asyncio.sleep(0.5)
``` when you have nothing to do
Wow it works
we love an api abuse queen 👑
@earnest phoenix that bot is private
and that matters how
so it doesnt use the api?
But only i see it
:(
you're spamming the same endpoint over and over again with no use case
ergo api abuse
just increase it to like 3-5 seconds and you should be good
But it doesn't bother anyone, only I see it
doesnt matter
I can break the Api?
spamming the api is bad regardless of who it's sent to
regardless
so it doesnt use the api?
who is sent to
Can I create problems for someone?
you create problems for the discord servers
And I am alone in that server
do you know how an api works
your server is a discord server
It's a private pokecord spam server
its still a discord server
I am the unique member
its still a discord server
Ok
Wow, I will break my server
looking at you daily weather bot
no, you help break discords servers
Hi guys! Quick question, if I'm "enabling" webhook options, will I stay able to use the request method?
no, you will help slow down the entire discord platform, albeit by a very small amount, but still
small amount as one user
but lots of users doing it make a big impact
^
@quartz kindle I asked this, thanks for be the unique person able to respond me
try setting up a very basic api, and set up a script that spams requests to it. run several instances of the script and see what happens
Why I have to do a YouTube Tutorial for do a bot XD?
And why I have to create a server
No, it have sense
?
Lang + Lib + Code + Error @storm sonnet
What is the error?
But thanx for responding and have a good one

@indigo geyser its ok i just need my bot online
Ye
Ok, and why it doesen't go online?
IDK thats why lol
Its says it need coding
Oh wait
OOF
Guess what
I just deleted the code that i copied like a retard
Why you copied it
Its my old code
make cool code
Got dang it gotta start again
My last code did for a secong till i mess up
Ok, pls send it, so I can help you if it's python
Also ima be honest with ya
Im in this server that this teacher helps ya you learn codes so im in position to start making the bot thats why
SEND THE CODE OR WE CAN'T HELP YOU
Ok, bye
Have a good one
Yes
Stop waiting time on me please i dont wanna make you feel mad
But I asked you a simple question
IK
if you people are going to keep yelling at each other them im going to start handing out phat mutes k?
it stops now
ty
Mute me?
NVM ill look it up on youtube plaese stop i dont wanna get in trouble
Im just a code starter
Sorry @loud salmon
I am not screaming now
everyone starts somewhere
Ik but im just acting like a little kid cuz its my first time so im sorry that i acted like a kid
But im thank full for those who tries to help
But ill try my best to get it right
Sorry to disturb and have a good one yall
you're good
(node:9308) UnhandledPromiseRejectionWarning: TypeError: #<Object> is not iterable
what's up here with eris collections?
@sick cloud would be good if you put listners for that
it's
so we can have stacktrace and handle that error
it's the base code of eris
yas so if its eris fault
PS C:\Users\ThatTonybo\Desktop\musicbot> node index.js
(node:9308) UnhandledPromiseRejectionWarning: TypeError: #<Object> is not iterable
at new Map (<anonymous>)
at Map.add (C:\Users\ThatTonybo\Desktop\musicbot\node_modules\eris\lib\util\Collection.js:41:19)
at ExtendedClient (C:\Users\ThatTonybo\Desktop\musicbot\src\ExtendedClient.js:34:35)
at process._tickCallback (internal/process/next_tick.js:68:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)
at startup (internal/bootstrap/node.js:279:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:752:3)
(node:9308) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:9308) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
41:19
what is 34:35 of extended client?
try using default maps and add that
right i'll just make my own collection then
wait is that an array
oh so prolly custom method then?
this.commands = new Store();
store.js
const { Collection } = require('eris');
module.exports = class Store extends Collection {
constructor() {
super(Map);
}
get(id) {
const item = this.find((item) => item.id === id);
return item;
}
}
.add is built into eris' collections
collection is a map
yeah
you can use the map methods instead and see if that works
I doubt the map methods it inherited from original will bork
i guess
@quartz kindle how do I define it so it's not global
I know eris since I used it, from time to time
as for how I bind events
let files = fs.readdirSync('./events')
for (const file of files) {
const event = require('./events/' + file).bind(this)
client.on(event.split('.')[0], event)
}
thats basically how I do it
@sick cloud
yeah, error handling goes to the actual event file
i kinda can't install node-opus 
gyp ERR! stack File "<string>", line 1
gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:289:12)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at maybeClose (internal/child_process.js:962:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)```
windows host machine, kinda rare to see that
anyways I think thats an py error
idk py stuff
mkay
all people developing bots are using discord.js except for me wtf
@candid lynx I use py.
Do you use BASIC?
lmao im on java @candid lynx
👌
cool
how do I define a certain part of the body in a json response?
like pull a certain value?
parse it
im using request
Lol
Slowest http client jfyi
but then how do I parse it
JSON.parse
You're parsing a string
@tight heath only use it when Im lazy or dont want to use node's http requests
@amber fractal superagent
It's like request but better
Faster and more precise syntax
yw
JSON.parse(json-string)
tbh request is slow but native node requests broke on me so im still remaking this command
I tried that
stupidly
i just put json
🤦

i get this now
👌
what
probably json-string.parse() or something lol
We all make mistakes
Nik was confused why the website is building so slow before he noticed he forgot to actually deploy it
lol
I literally mistyped success and wondered why .sucess() was not a function
oh shoot i just figured out that my bot is running in 2018
JSON.parse(whatever you wanna parse)
usually requests are in the body so parse the response.body or whatever
and it has a command that actually needs a correct year
i think
new Date().getYear()?
no it was pulling a unix
and adding 2018 to it
so like taking a time
adding the year and making a unix
but all the unixs were in 2018
not 2019
request is still slow though
oh and fun fact also
I didnt put JSON in caps
other issue
Yes but you can dynamically get the current year
Literally new Date().getFullYear()
Pulls from system time
Why
aws was locking me into CST for a while
no idea how nor why
it only resolved itself a few days ago
after an update
well it takes from the system time, so if you're running on a vps you need to account for server location
or that
No worries
Date has a bunch of methods
That's why I'm here

Yeah, ravy is customer support
lol
I actually am
ping them all the time

if you have any question
w3schools told me to write 20+ lines
For @versed thorn kinda
for what was supposed to be 4 lines
w3schools isnt the best
soo as i was saying almost everyone uses discord.js so im switching now
@candid lynx from?
from discord.py
uh
cuz...i hate the indenting in python...
the lib itself should not be your deciding factor
Well any good eslint config in js has the same indentation
python syntaxing is pretty uh annoying
also quick question in js







