#development
1 messages ยท Page 355 of 1
this is
guild.channels.filter(c => c.permissionsFor(guild.me).has(["SEND_MESSAGES", "EMBED_LINKS", "VIEW_CHANNEL"])).sort((a, b) => a.calculatedPosition-b.calculatedPosition).first().send({embed: embed1})
``` line 21
and here is my error
0|TurtleBo | RangeError: Invalid permission string or number.
0|TurtleBo | at Function.resolve (/root/Bot/TurtleBot/node_modules/discord.js/src/util/Permissions.js:168:65)
0|TurtleBo | at Permissions.has (/root/Bot/TurtleBot/node_modules/discord.js/src/util/Permissions.js:62:35)
0|TurtleBo | at permission.every.p (/root/Bot/TurtleBot/node_modules/discord.js/src/util/Permissions.js:61:72)
0|TurtleBo | at Array.every (<anonymous>)
0|TurtleBo | at Permissions.has (/root/Bot/TurtleBot/node_modules/discord.js/src/util/Permissions.js:61:56)
0|TurtleBo | at guild.channels.filter.c (/root/Bot/TurtleBot/events/guildCreate.js:21:63)
0|TurtleBo | at Map.filter (/root/Bot/TurtleBot/node_modules/discord.js/src/util/Collection.js:228:11)
0|TurtleBo | at module.exports (/root/Bot/TurtleBot/events/guildCreate.js:21:24)
0|TurtleBo | at <anonymous>
0|TurtleBo | at process._tickDomainCallback (internal/process/next_tick.js:228:7)
you can't give .has an array
Will anyone make my brother a bot? For free
lol
should i use .includes @umbral pelican
actually, the docs says you can 
doesn't say invalid permission
might be because it's a voice channel
wdym?
well, you can't have "Send Messages" for a voice channel
but I just checked and it works fine for that as well
you sure that's the line it's erroring on?
that code works fine, other than it will find voice channels / categories as well
aids
How do i check if content is nsfw when web scrapping the content?
Let's say google images
make a self learning AI and make it watch porn till it knows what SFW and NSFW is. Then boom you have a boolean
Correct!
restrict some keywords @compact scaffold
for example
Oh
Im not giving you all keywords for nsfw
lel
Like a list ๐ค
safe search is a thing
Caused by: com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'default'
at com.typesafe.config.impl.SimpleConfig.findKeyOrNull(SimpleConfig.java:152)
at com.typesafe.config.impl.SimpleConfig.findKey(SimpleConfig.java:145)
at com.typesafe.config.impl.SimpleConfig.findOrNull(SimpleConfig.java:172)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:184)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:189)
at com.typesafe.config.impl.SimpleConfig.getString(SimpleConfig.java:246)
at xyz.rembot.discord.utils.Settings.<clinit>(Settings.java:13)``` same
and ```conf
default {
prefix: ">"
name: "RemBot"
shards: 1
}
Is it possible to filter a presence for when someones streaming for discord.js
yes, the type will be 1 if streaming
@topaz fjord that's not how you do MySQL queries ๐ญ
Wut

About 20 message above
Oh that
ye
It works....
How do I make the bot DM me? So like it sends "I've joined a guild." to me when it joins a guild
which language?
Discord.js
lol
Thanks
@vestal grail interact with bots in designated channels pls
I tried, but it's muted so I figured I might be able to use it over here. Well, that failed...
i mean we can unmute your bot if the issue is fixed
yeah it will keep sending messages that you have earned a crate, so no worries you can leave him muted
because that's kindof the entire purpose of the bot
๐
there is anyway to remove the code block of the prefix with CSS?
display: none baby
ktnx
hello
@next bluff any way to get rid of it without removing the entire bot prefix? So you still keep the prefix thing but remove the background?
Umm, I'm not looking at the page right now but you could use border: none and change the background color to match the surroundings
ok
I'm new at making bots can anybody tell me how to make commands for my bots?
What library?
guys, how to get members username and discrim from their id?
any1 who could help pls?
if you have a bot, you can just make a request to the appropriate api endpoint
or check if the lib has the user cached
odds are you're using some bot library in that case, so consider looking through the docs
couldn't you use <client>.users.find
hmmm... good idea @abstract mango ๐
Discord.js is a powerful node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
Client#users.find isn't guaranteed to work I don't think
it'll retrieve the user if and only if it's already been cached
๐
javascript
"JavaScript Object Notation"
To start I would say js
You kinda just answered your own question there
I'm assuming you looking at discord.js right
Or Eris?
either way he's gonna have fun
A lot of it
Eww JS 
shush! It's a starting point
Eww .timo
Lol
.js
That's not even a file extentions though 
lord help us
node <filename> in a console that is path's located to where the .js file is
I suck at explaining
Whoa racist much
god damn
woah
you can stop now
too much smart you may hurt yourself
stop or 
^
@glossy sand can we get a mute for this guy
Yes but this isnt development...
No
are you okay?
bruh
json api bloody wat
someone already did
That's easy.
or smth
So sure Vulgar just did a couple of msgs up
^
^
Thank God for that
lol
my bots d.js
he gone
I just read a little bit of the convo and that guy was already getting on my nerves
lmao
I told him stop or 
He got 
look under your seat is a 
Joined !Discord Botz With 876 <-- bot ramdomly put this in my console window

illuminati
Ok
Can someone help me, I am using discord.js and I am trying to find a way to show how many servers my bot is in like in the bots playing message
right so let's look at the docs
alright
you'll notice the Client object has a property called guilds, which is a collection of all the servers the bot's in
what about client.servers?
๐
My music bot (Javascript) joins the voice channel, but then returns Error: spawn EACCES
are you trying to run a shell command from your bot?
No. I do /play [song], it joins, then returns in console Error: spawn EACCES
and did you write the bot?
see if the child process module is used at all
as far as I remember, spawn EACCES is thrown when you try to run a command but don't have the proper permissions
does the user running the application have proper permissions?
well, not discord permissions
Perms on the bot? Yes.
like permissions in linux (I assume that's the OS you're using?)
Oh yes.
k just thought I'd ask
where does get discordbotlist token
You can get that on your bots edit page or in the API documentation if you're logged in
@hearty bramble ^
oh its probably because i havent got my bot approved yet ๐ค
I'm trying to make so that if someone levels up on dbl it sends a message in #265156361791209475 but if it's out of dbl it sends it in any channel.
You can do a check if the guild id is equal to this servers ID then change the channel it is sent to.
That's pretty easy
depends on the library and language though.
I'm using discord.js
How good are you with discord.js?
not that good
So how are you sending your messages currently for the leveling up?
message.channel.send(level up here)
So above that you can do this
if (message.guild.id == "264445053596991498") {
let channel = message.guild.channels.find('name', 'bot-hell');
channel.send(`stuffhere`);
} else {
// Normal send here //
message.channel.send(`stuffhere`);
}
Replacing that thing you sent a moment ago
No problem and there is many better ways to do that, I encourage you to learn off what I gave you and improve on it.
Like catching errors and such
Yeah
Hey, I'm trying to make a dev command for my bot, where it'll list all the guilds it is in, with the ID of that guild behind it.
I'm using discord.js
Anyone a solution?
Just the guilds its in is pretty simple
True
You got that or?
That's a simple map()
yeah
I mapped all the names
But I want the ID of that same guild behind it's name
I know it's possible though, I just don't know how to do that XD
Yeah
help me in server count
{ Error: getaddrinfo ENOTFOUND https://discordbots.org https://discordbots.org:443
10:22 AM
at errnoException (dns.js:28:10)
10:22 AM
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)
10:22 AM
code: 'ENOTFOUND',
10:22 AM
errno: 'ENOTFOUND',
10:22 AM
syscall: 'getaddrinfo',
10:22 AM
hostname: 'https://discordbots.org',
10:22 AM
host: 'https://discordbots.org',
10:22 AM
port: 443 }
10:22 AM
10:22 AM
code?
nvm got it fixed
mmmk
How do I pause and resume a song in discord.js without it skipping a couple of seconds and then playing a second and skipping another couple of seconds? Because right now my pause and resume command does just that. Is there like any way to pause ffmpeg?
@slow elk d.js?
@thorny hinge doesnt it say discord.js in the message
Im asking him @earnest phoenix
I use d.js so I wanna make sure rooty does too so I can be able to help 
oh right
client.guilds.map(g => `${g.name} - ${g.id}`);
``` that would work
@thorny hinge It works. Thanks a lot
No problem
How does one implement the API token into the bot files?
to get server count?
Wdym
Yea, for the server count.
Or do I need the following codes:
"server_count": client.guilds.size
lol do it
Anyone here can help me with C#? ๐
I want to code the playing tag for my bot, but I don't know how to.
Isn't there a documentation for whatever library u are using?
How would I get the join position of a user? (d.js)
Wouldn't it be just the member count when the user joins?
unless you mean all the joins that ever happened no the server
guild.members.size as far as I know
well I don't need the size of it
how do I use membercount to find join position?
Not sure it's possible
The Bot pages long description is only CSS unless your certified right
No, you can put HTML in the long description so you can include CSS tags as well
oops sorry meant to include html there as well
You can use HTML and CSS, however only certified people and mods can use javascript
okay thats what I thought
lol I look all these intelligent people who know CSS and stuff while I have a thing that needs little to no effort.
I know fuck all about css and shit except for the basics ๐
Ok sorry
Joined PUBGAndFriends With 6 lol why my bot its trash
@slow elk
simple but works
Is that to display the server count? @blissful reef
Nah, mate, I already got it. Thanks anyway @blissful reef
lol
How do I get intelliJ to find my SDK? I've downloaded the JDK from java but it still doesn't see it
2017-12-29T17:10:38.222-0800 I CONTROL [initandlisten] MongoDB starting : pid=9856 port=27017 dbpath=C:\data\db\ 64-bit host=Sid-PC
2017-12-29T17:10:38.222-0800 I CONTROL [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2017-12-29T17:10:38.223-0800 I CONTROL [initandlisten] db version v3.6.1
2017-12-29T17:10:38.223-0800 I CONTROL [initandlisten] git version: 025d4f4fe61efd1fb6f0005be20cb45a004093d1
2017-12-29T17:10:38.223-0800 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1u-fips 22 Sep 2016
2017-12-29T17:10:38.223-0800 I CONTROL [initandlisten] allocator: tcmalloc
2017-12-29T17:10:38.223-0800 I CONTROL [initandlisten] modules: none
2017-12-29T17:10:38.223-0800 I CONTROL [initandlisten] build environment:
2017-12-29T17:10:38.223-0800 I CONTROL [initandlisten] distmod: 2008plus-ssl
2017-12-29T17:10:38.223-0800 I CONTROL [initandlisten] distarch: x86_64
2017-12-29T17:10:38.223-0800 I CONTROL [initandlisten] target_arch: x86_64
2017-12-29T17:10:38.223-0800 I CONTROL [initandlisten] options: {}
2017-12-29T17:10:38.223-0800 I STORAGE [initandlisten] exception in initAndListen: NonExistentPath: Data directory C:\data\db\ not found., terminating
2017-12-29T17:10:38.224-0800 I CONTROL [initandlisten] now exiting
2017-12-29T17:10:38.224-0800 I CONTROL [initandlisten] shutting down with code:100
Data directory C:\data\db\ not found., terminating
when doing mongod
Reading the error goes a long way.
i thought it auto makes ๐
unfortunately, I don't think it does
you'll just have to make the dir \data\db manually then see what happens
am i doin somethin wrong
db.stats.insert( {server_count: 229, shards: []} )
and stats is my collection
it says db.stats.insert isnt a function
So you can't directly insert an array in sqlite.. any workaround? 
maybe could join it with a unique character then on readout split by that?
so then jsut inserting a string
AAa
Pls
It doesnt even check if the person has a higher role or lower role than the mentioned user

Hey, is it possible to insert an array or JSON object in an sqlite column directly?

sql.run("INSERT INTO idk (whatever) VALUES (?)", [["array"]]);
``` smth like that
So after inserting it as a string I can then do
let x = await sql.run(`SELECT * FROM idk WHERE something = somethingelse`);
console.log(x.whatever);
And itll return ["array"]?

In theory, you get that value on var
But you might need to run a function to make JS engine know it's an array
Someone already used node-dogstatsd
anyone wanna help me find out what's wrong with my blacklist code?
if(!message.member.hasPermission("MANAGE_MESSAGES")) return message.channel.send("You do not have permissions to use this command.");
let toBlacklist = message.guild.member(message.mentions.users.first()) || message.guild.members.get(args[0]);
if(!toBlacklist) return message.channel.send("You did not specify a user (or ID) to blacklist! `Usage: blacklist <@user>`");
if(toBlacklist.id === message.author.id) return message.channel.send("You cannot blacklist yourself, silly.");
if(toBlacklist.highestRole.position >= message.member.highestRole.position) return message.channel.send("Nice try, but you cannot blacklist a member with a role higher than you!");
let role = message.guild.roles.find(r => r.name === "2D Blacklisted");
if(!role){
try {
role = await message.guild.createRole({
name: "2D Blacklisted",
color: "#000000"
});
} catch(e) {
console.log(e.stack);
}
}
if(toBlacklist.roles.has(role.id)) return message.channel.send("This user is already blacklisted!");
bot.blacklists[toBlacklist.id] = {
guild: message.guild.id,
user: toBlacklist.id,
by: message.author.id
}
await toBlacklist.addRole(role);
fs.writeFile("./blacklistedusers.json", JSON.stringify(bot.blacklists, null, 4), err => {
if(err) throw err;
message.channel.send("I have blacklisted the user! Be gone, abuser!");
});
return;
doesn't return any errors except this
(node:50252) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot set property '317619987311230976' of undefined
(node:50252) [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.
the property being the target's id
Traceback (most recent call last):
File "C:\Users\Isaac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\client.py", line 307, in _run_event
yield from getattr(self, event)(*args, **kwargs)
File "C:\Users\Isaac\Desktop\programs\bitbot\bot.py", line 25, in on_message
await command.run(cmd, args, msg, user, server, channel)
File "C:\Users\Isaac\Desktop\programs\bitbot\command.py", line 8, in run
await client.send_message(channel, "t")
File "C:\Users\Isaac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\client.py", line 1152, in send_message
data = yield from self.http.send_message(channel_id, content, guild_id=guild_id, tts=tts, embed=embed)
File "C:\Users\Isaac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\http.py", line 200, in request
raise HTTPException(r, data)
discord.errors.HTTPException: UNAUTHORIZED (status code: 401): 401: Unauthorized```
it has permissions on the channel
@ebon apex
import re, sys, time
import discord
from discord.ext import commands
import asyncio
import command
description = '''A bot for everything BitCoin'''
client = commands.Bot(command_prefix='~', description=description)
prefix = "~"
print("INIT")
@client.event
async def on_message(message):
msg = message
user = msg.author
server = msg.server
channel = msg.channel
if msg.content.startswith(prefix):
args = msg.content.split(" ")
if args[0].strip(prefix) in command.commands:
cmd = args[0].strip(prefix)
del args[0]
await command.run(cmd, args, msg, user, server, channel)
if __name__ == '__main__':
client.run(TOKEN)```
from modals import *
import bot
commands=["price"]
client = bot.client
async def run(cmd, args, msg, user, server, channel):
if cmd == "price":
await client.send_message(channel, "t")
Traceback (most recent call last):
File "C:\Users\Isaac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\client.py", line 307, in _run_event
yield from getattr(self, event)(*args, **kwargs)
File "C:\Users\Isaac\Desktop\programs\bitbot\bot.py", line 25, in on_message
await command.run(cmd, args, msg, user, server, channel)
File "C:\Users\Isaac\Desktop\programs\bitbot\command.py", line 8, in run
await client.send_message(channel, "t")
File "C:\Users\Isaac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\client.py", line 1152, in send_message
data = yield from self.http.send_message(channel_id, content, guild_id=guild_id, tts=tts, embed=embed)
File "C:\Users\Isaac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\http.py", line 200, in request
raise HTTPException(r, data)
discord.errors.HTTPException: UNAUTHORIZED (status code: 401): 401: Unauthorized```
Happening on every channel?
Has perms to send and read?
strange
it works
when
i send it outside of the commands.py file
and instead in the bot.py
file
will it unauthorize me if i have 2 instances of the bot running?
Look into sharing the client between files I'm pretty sure you can in python similar to how you do in js
yep
that must have been thge problem
fixed now
and yeah i passed client through as an arg this time
who's good at discord.js
me, sortof
target's id which is the toBlacklist's id?
yes
I would say there is no user with that id so it returns undefined?
no because then it would return "you did not specify a user"
exactly i'm confused
it doesn't create the role, give anyone the role, or update the .json file
It has the permission to create it?
yes
it works with other commands such as mute
which creates a muted role
so idk wtf is wrong
Alright here comes a spastic moment
How tf do i get my bot to show its server count when i command Luca to show my bot stats?
XDDDDDDDDDDD
Nevermind my spastic brain figured it out >.<
Hey that's weird I dont receive any data on my datadog
https://hastebin.com/yupajemoca.cs
Ok
yo Kiru
yo
private async Task HandleCommandAsync(SocketMessage arg)
{
var message = arg as SocketUserMessage;
if (message is null || message.Author.IsBot) return.; // this is all red :(
int argPos = 0;
if (message.HasStringPrefix("ta!", ref argPos) || message.HasMentionPrefix(_client.CurrentUser, ref argPos))
{
var context = new SocketCommandContext(_client, message);
var result = await _commands.ExecuteAsync(context, argPos, _services);
if (!result.IsSuccess)
Console.WriteLine(result.ErrorReason);
}
ok nice dude
Hi whats the problem?
cant read sorry
what lang and lib?
mmmm I'm no experienced with c# but shouldn't it be if (message = null || message.Author.IsBot) return?
just a gusse from my js knowledge
return.; why is there a . there?
thats a ; ๐
No in the thing you posted it's .;
What do you use to code?
Cause if you're using VS it should tell you what you're doing wrong
but its doesn't tell anything D:
not even in the terminal?
operator || cannot be applied to operands of type <null> and bool :/
then || can't be applied to null and boolean?
lol yes
mmm idk, as I said, Idk c#
what is this?
How to see the uptime of a bot? discord.js
function secondsToString(seconds) {
seconds = Math.trunc(seconds)
let numdays = Math.floor((seconds % 31536000) / 86400)
let numhours = Math.floor(((seconds % 31536000) % 86400) / 3600)
let numminutes = Math.floor((((seconds % 31536000) % 86400) % 3600) / 60)
let numseconds = (((seconds % 31536000) % 86400) % 3600) % 60
return `${numdays}d:${numhours}h:${numminutes}m:${numseconds}s`
};
@lethal sun
hmm.. any SIMPLE ways to do it?
uh yeah the one i just sent you
unless i'm retarded and discord.js added an uptime string
but that's how i do it lol so
ยฏ_(ใ)_/ยฏ
Sorry for disturbing, but do you know, where to get many examples of discord bots code?
Anyone good with streaming audio to shoutcast/icecast on python 3.6?
I thought that i'm dealing with profesionals ๐ฆ @languid dragon
You are
You could simply Google and retrieve the answer you're looking for in a matter of seconds
just because someone didn't answer you doesn't mean people aren't professionals lmfao
Try Googling lines such as Python Discord Bot GitHub
There are bound to be some open source bots on GitHub
I know, but how could you live without page with that content
What
English?

What lib?
d.js
member.bot is not a thing pls read docs kthx
Search for GuildMember#addRole
Docs are amazing
Discord js read the docs is outdated
my life has been wasted
Discord.js Enmap.
It says that guildConf.map is not a function
let configKeys = guildConf.map( (value, key) => `${key} : ${value}`).join("\n");
key and value are both defined too idk whats meant by it
anyone know how to chnage the _id property in mongodb?
Daddy, any AIdea why my code will not work lol
@crystal void You good with Enmaps or whatever they are? I seem to have an error with my code and i cant seem tyo get it to work again!
Error: guildConf.map is not a function
Code:
let configKeys = guildConf.map( (value, key) => `${key} : ${value}`).join("\n");
Oh, its okay. Nevermind
๐
@earnest phoenix Sorry for the tag but do you know why this is happening? Is it being Depricated... I have no idea what to change it to...
?
Above
Code block
What is your end goal?
Show a config lol hold up
wtf
just require it
is it a .js or .json file?
enmap... No file i dont think lol
if(command === "showconf") {
let configKeys = guildConf.map((value, key) => `${key} : ${value}`).join("\n");
message.channel.send(`The following are the server's current configuration: \`\`\`${configKeys}\`\`\``);
}
oh
getting a SERVERS config
a .js file
idk man
I only use databases
Your best bet maybe is to FS read the file
parse it
then split
or seomthing
Damn
Alright, thanks lol
Woe
{ Error: 400 Bad Request
at _response.transport.finalizeRequest.call.then (/app/node_modules/snekfetch/src/index.js:198:23)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
request:
ClientRequest {
domain: null,
_events:
{ abort: [Object],...............................(a lot of things)
``` What is this?
and how i can rezolv?
you seem to have something wrong with your snekfetch module
try updating node, updating snekfetch, etc.
snekfetch.post(`https://discordbots.org/api/bots/393359617310195713/stats`)
.set('Authorization', "HIDDEN")
.send({ server_count: client.guilds.size,
//shard_count: client.shard.count,
//shard_id: client.shard.id })
})
.then(() => console.log(`Posted to dbl.`))
.catch((e) => console.error(e));
``` What is wrong?
what response are you getting back?
Then use something to POST it? nvm ur having trouble.
how i can rezolv?
nothing looks blatantly wrong about it, what problem are you running into?
if you're actually using "HIDDEN" for the authorization header, that would be one problem
oh I didn't see your other message, you were getting a 400 response
can someone here help me out with mongoose
I'm not really sure what the problem is if you're getting a 400 error. Try sending the raw request from Postman or something and see if that works
you need to make sure you have the right auth token
is ECMA script pronounced E-C-M-A script or Ehckma script 
2nd one
it's fun to stay at the E M C A
client.user.avatarURL?
any particular VSC plugins I need for JS development?
@scenic crest. Eslint 
eslint and not much else really
but consider using typescript if you don't want your brain to explode once your project scales up
doing ECMA6 because why not
I'm not planning on doing naything major with it
but ig I'll see where I'll go
have fun with that
Is there a way to get a bots pfp url from I'd in a website
@glossy sand so am I understanding it corectly, tc compiles into a js file which I can then run with node?
right
Why when I do this donโt it work?
msg.channel.send(โPinging...โ);
m.edit(โ[n.] pongโ);
Ignore the [n.]
I trained msg.edit
Still not working
wouldn't it be something like msg.channel.send("Pinging").then(m => m.edit("pong"));? i'm not sure though
doubt it
@earnest phoenix well couldn't you use variable? lol
var m = msg.channel.send('ping')
m.edit('pong')
or is that what you're doing
oo
ok so I have this really weird issue where somebody in a server isn't showing up on the server's member list
like I can see them in the server, but when I bring up the member list with
bot.servers[bot.channels[channelID].guild_id].members (discord.io)
their userID just isn't in the list with everyone else
@shell bane is this member offline?
since Discord doesn't send the presence for those and this can cause issues especially if the lib is outdated
no they're online
yeah usually if a person is offline or appearing offline some libraries can just die
this will show a perosn if they're online and just not have a status usually status is 'online'
but he is online and just not showing up as existing in the server
as far as the library is concerned, in discord we can see him in the server just fine
or it may be the outage that's going on rn
although it may do with that notice that just came up with outages
Can We Use JavaScript Tho?
why couldn't you
Try this console.log(user)
or
var m.log("ping.user")
console.log(ping:discordapp.com/)var()
will that work?
idk
i tryed code class,
im fu**ing tripping out cuz of it xD
im going to get banned,
i know it
at least i censored it
maybe...idk
console.log("Hello!") console.log("Please select a Channel to Continue!")
will that work?
this my test
console.log("Hello!");
console.log("Select a Server To Continue!")
or even
console.log("Welcome!)
var m (ping)
console.log("0010001.length")
var m (connect(83.length))
log(if user exits ask to reconnect)
log(terminal:reconnect)
server.js
end
will that even work?
end
Maybe you should try Ruby
uhhhh
I don't think that's compliant javascript
...or compliant any-other-language
perhaps you should try starting from the basics and building your way up instead of immediately diving into such an advanced project as a discord bot
Ruby is the lang that uses end.
I recommend you using codecademy to learn languages
There's also crystal that uses ruby syntax, but it isn't properly backed yet
Here is the discord lib for ruby https://github.com/meew0/discordrb/blob/master/README.md
require 'discordrb'
bot = Discordrb::Bot.new token: '<token here>'
bot.message(with_text: 'Ping!') do |event|
event.respond 'Pong!'
end
bot.run```
for a bot mention as a perfix do i just list it in the prefixs or...
Really?
@icy lynx
i want my bot to say my prefix is >< when someone mentions it
How'd you do it without tagging yourself?
@earnest phoenix
put a \ at the start
@earnest phoenix
That still tagged me
There should be something on your wrapper that tells what users have been mentioned
@Demi-lea#7951
still showed the id
nope
my bot tells me nothing
:(
im lucky i could add a server count to the page
Did you do that on a channel here?
do what
Testing
no
Is your scripting checking if the message starts with @proper comet?
@earnest phoenix
im a noob man mine is as basic as it could be
I put the ! yet it still tags me xD
To debug it easier, you can make it log the messages to cmd
i did that but when i listed the name it came with the oposite to what i wanted
${msg.author} has used the invite command! Wow very helpful bot
It should look like @proper comet help
What have you been doing 
the command?
Show code
i just cnearly deleted it hold on
๐
So, you didnt make it check for the bot id?
if (msg.channel.type === 'dm') return;
if (!msg.content.startsWith(keys.prefix)) return;
if (msg.content.startsWith(keys.prefix + 'play') && !msg.guild.member(client.user).hasPermission('CONNECT') || !msg.guild.member(client.user).hasPermission('SPEAK')) return msg.reply(':no_entry_sign: I don\'t have the **Connect** or **Speak** permission!');
if (commands.hasOwnProperty(msg.content.toLowerCase().slice(keys.prefix.length).split(' ')[0])) commands[msg.content.toLowerCase().slice(keys.prefix.length).split(' ')[0]](msg);
});```
@neat pawn
Is the 4th one the one with the mention?
341702872901353493 if (!msg.content.startsWith("@neat pawn")) return;
would that work
it didnt have the mention in it it was the ID
Should work
R2V0IG91dCBvZiBteSBoZWFk
Searching a team mate for manage/code @open oar stuff with me
(DM me/mention me)
Is it impossible to make custom embeds with the youtube video player in it?
Nope you cant use embed vids
cool, I'll stop wasting my time on that then lol
You can use gifs though
good to know
Sorry but does anybody know why the fuck my bot is responding with every prefix? It responds with everything such as !ping, ยฃping, $ping, rping etc
I have already asked staff to unmute GameBot as it workedd on my tewsting server! Im using JavaScript
const prefix = "$";
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
//Further down the code. The botinfo comand. Only tested this on this command!
if(command==="botinfo") {
console.log(`${message.author.tag}: ${commandused}`)
client.channels.get(config.logID).send({embed: {
color: green,
description: `**${message.author.tag}:** *${commandused}*`
}}).catch(console.error);
if(message.guild.member(client.user).hasPermission("MANAGE_MESSAGES")) {
message.delete().catch(console.error);
}
return message.channel.send({embed: {
color: green,
author: {
name: message.author.tag,
icon_url: message.author.avatarURL
},
description: `
**Game Bot Information:**
**Username:** ${client.user.username}
**Discriminator:** #${client.user.discriminator}
**ID:** ${client.user.id}
**Bot Developer:** [SKILL SHOTZZZ#1716]()
**Bot:** True
**Created At:** ${client.user.createdAt}
**Avatar:** [Click to View](${client.user.avatarURL})
**Current Servers:** ${client.guilds.size} Guilds!
**Current Users:** ${client.users.size} Users!
**Rating:** 5 Star Bot!
`
}}).catch(console.error);
}
Oops sorry hold on let me get rid of that
I have tried restarting the bot multiple times already...
Ping me im going AFK
@earnest phoenix It's respond to every prefix because you have prefix.length. It only sees that the length is one and then responds to every prefix that only has one character. Maybe try js if(!message.content.startsWith(prefix))) return;
I don't know
Oh yeah ๐ Thanks you got it working for me lmfao ๐
lol np
Can someone help me? I'm trying to import ListenerAdapter but I don't get that. Instead it shows two options to fix it, create a class (which I don't want to) and add a maven dependency (which I also don't want). I just started the project and my pom.xml file looks like this: ```xml
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>9</source>
<target>9</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>3.4.0_319</version>
</dependency>
<dependency>
<groupId>com.sedmelluq</groupId>
<artifactId>lavaplayer</artifactId>
<version>1.2.34</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>jcenter</id>
<name>jcenter-bintray</name>
<url>http://jcenter.bintray.com</url>
</repository>
</repositories>```
Whuts one of them lol
Bruh im trying to get the server count from the dbl API thingy but this error pops up, I put in my token and everything else but this is the error:
Error: Cannot read property ID of null.
Code:
path: `/api/bots/${client.user.id}/stats`,
@quiet bobcat open the maven tool window (google, forgot how to off the top of my head) and press the blue refresh button, usually fixes ir for me. Oh and make sure maven auto import is enabled
Ah thanks
Hello, I have a question. Does anyone know a tutorial on how to disable and enable modules? Like a code tutorial? I have different files for discord.js bot, all the different files have different commands. Like a stop and start command for modules. I already have reload. If you know, DM or mention me. Thanks
@bitter sundial i don't know why but a part of my custom html is displayed like this
-bots @quasi sandal
@glossy steeple
Tonkku question, can uncertified developers embed flash in their bot pages?
@quasi sandal I think I fixed it, same thing as just in #267327844357636097
oh ok
@earnest phoenix you got it fixed yet?
@gusty topaz please don't use flash
Can someone fix this so that is replies to a ping:
if(message.content.startsWith("@JZN Studios BOT")) {
message.channel.send("My prefix is ${keys.prefix}, Try out ${keys.prefix}help to see my commands!");
}
});```
@earnest phoenix see the thing is
internally
discord doesn't see your mentions as
@user#0000
but rather as <@userid>
@quasi marsh
So I put the id
so you need to replace @JZN Studios BOT with <@the id of your bot>
@azure ether?
@neat pawn
do i need a !
lets see
Also if you want to mention a user from your code, you also need to do <@user id> instead of @User#0000
thx it worked
you are welcome
@mighty barn Yeah, fixed a while ago.
oh, ok.
I might sound stupid but I have to idea how to embed
what lib?
d.js k
channel.send({
embed: {
color: 3447003,
title: "Just a test",
url: '<URL THAT THE TITLE LINKS TO>',
thumbnail: {
url: bot.user.avatarURL
},
image: {
url: '<ADD AN IMAGE TO THE EMBED (URL HERE)>'
},
fields: [
{
name: 'Test',
value: 'This is a test field',
inline: true
},
{
name: 'Test 2',
value: 'This is the second test field',
inline: true // Allows the fields to be side by side
}
],
footer: {
icon_url: bot.user.avatarURL,
text: prefix+'Test'
}
}
});
something like that
you can look on the docs for something more complicated
There is an error in that code... but it is something like that
url in the embed
fail
it would be [Just a test](GET YOUR FUCKING URL IN HERE)
as title
Im using discord.js but im not sure why this code is not working. It says that guildConf.map() is not a function but i dont know what to replace it with!
if(command === "showconf") {
const configKeys = guildConf.map( (value, key) => `${key} : ${value}`).join("\n");
message.channel.send(`The following are the server's current configuration: \`\`\`${configKeys}\`\`\``);
}
Using enmap module
it is for a per server configuration
Please Tag me, Going AFK
Question, I wanted to use the discord-bots-api node package (https://www.npmjs.com/package/discord-bots-api) since it seemed like a good API wrapper for the site, but I get a 401 invalid auth on all its functions: UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): StatusCodeError: 401 - {"error":"Invalid auth"}
this regardless of being 1000% sure that I have a good API key from the site because I only requested it like 10 minutes ago.
@fervent goblet about what you said earlier btw ... Discord.JS definitly has a URL property for RichEmbeds: https://discord.js.org/#/docs/main/stable/class/RichEmbed?scrollTo=setURL
The problem with @wooden shoal 's code was that it is displayAvatarURL and not avatarURL. Also do note that on DJS Master (and later stable) it will be displayAvatarURL() as function with options such as format
Good code:
msg.channel.send({
'embed': {
'color': 3447003,
'title': 'Just a test',
'url': '<AN AWESOME URL>',
'thumbnail': {'url': this.client.user.displayAvatarURL},
'image': {'url': '<AN AWESOME URL>'},
'fields': [
{
'name': 'Test',
'value': 'This is a test field',
'inline': true
},
{
'name': 'Test 2',
'value': 'This is the second test field',
'inline': true // Allows the fields to be side by side
}
],
'footer': {
'icon_url': this.client.user.displayAvatarURL,
'text': `${prefix}Test`
}
}
});
@earnest phoenix do you have an auth key?
I generated one (by now) 20'ish minutes ago and loaded it in the code the same way I load any other API keys
Please? can someone help me... I have been stuck tryiong to fix this issue for over an hour
Embeds donโt work on my bot
Sad
Show me the code @earnest phoenix ur using to send stats
That's odd Lea 
Im using discord.js but im not sure why this code is not working. It says that guildConf.map() is not a function but i dont know what to replace it with!
if(command === "showconf") {
const configKeys = guildConf.map( (value, key) => `${key} : ${value}`).join("\n");
message.channel.send(`The following are the server's current configuration: \`\`\`${configKeys}\`\`\``);
}
Im making a per system configuration thingy!
Im using the Enmap Module!
Erm I'm having dinner rn. I can send it afterwards and mention you then @topaz fjord
Oh? Hmm I'll have to look into that then
Someone told me to put thonking on my bot
Nice @earnest phoenix
nitro for bots when
@earnest phoenix I found your problem your using Evie's modules
Yeah lol
Db better
๐ฆ
@topaz fjord do I understand correctly that you basically want server specific settings?
Kek
Why mention me?
@earnest phoenix Its me that wants Per Guild Settings lol
@earnest phoenix easy
redis
key:
guilds:<insert_guildid>:settings:<settingname>
value: whatever the fuck you want
Sorry ye
Try the DiscordJS commando framework
It has SQL client provider
I'll show details to you after my dinner
ok
right so as I was saying, details.
The commando framework can be found on the same docs page, just change the Main Library to Commando: https://discord.js.org/#/docs/commando/master/general/welcome
Naturally these docs have a lot of info as it is, but for this detail stuff I'll keep it to the settings. Somewhere before you login you want to assign the client provider, which is generally best as an sqlite database. In my bot's code I do it like so:
this.client.setProvider(
sqlite.open(Path.join(__dirname, 'settings.sqlite3')).then(db => new Commando.SQLiteProvider(db))
).catch(console.error); // eslint-disable-line no-console
(On GitHub: https://github.com/Favna/Ribbon/blob/master/src/Ribbon.js#L210)
Once you have that you can write commands to control the settings in settings as seen here: https://discord.js.org/#/docs/commando/master/class/SettingProvider. Using this.client.provider.get('msg.guild.id','AnAwesomeToggle') would get the setting AnAwsomeToggle for the guild that the message is sent to referenced by its ID. For example in my bot I make it possible for server admins to toggle deleting command messages (the !someCommand) on and off with !deletecommandmessages as seen here: https://github.com/Favna/Ribbon/blob/master/src/commands/moderation/deletecommandmessages.js
Because the database file is sqlite it can also be opened manually with the program DB Browser for SQLite (http://sqlitebrowser.org/) and it will have a single table called settings with 2 rows (guild and settings). As you can probably expect now, the guild is listed by ID and the settings are all in the second field. Example picture (blurred 1 part because it is mildly nsfw but suffice it to say, in the commando framework commands can be individually toggled enabled or disabled on a per-guild basis)
@earnest phoenix forgot to tag you in there ^
why not use mysql
but mysql is a bit easier
at least I assume that's the reason Gawdly had (the dev of commando)
commando is ded
Pretty sure it also supports MongoDB but eh
@topaz fjord you asked for my code earlier
async run (msg) {
const discordbots = new DiscordBotsAPI(auth.discordbotsAPIKey),
post = await discordbots.postStats(this.client.user.id, this.client.guilds.size);
if (post) {
console.log(post);
} else {
console.log('error');
}
}
this.client.user.id evaluates to 376520643862331396 which is correct: https://discordbots.org/bot/376520643862331396
this.client.guilds.size evaluates to the amount of guilds the bot is in
auth.discordbotsAPIKey evaluates to my API key, obviously not sharing it here. I'm 100% sure this is correct as I do the exact same for other API keys (Steam, Google etc)
Rewriting the .then.catch promise system to async/await system has always worked fine in other packages so there is no reason that should be an issue here.
it logs error because of the StatusCodeError: 401 - {"error":"Invalid auth"}
also that if would return true unless post is null or undefined so it's either of those.
p.s. I know the package says .postStats returns undefined, but if it worked then I would assume I should be seeing the server count on the site now but...
why not just do
snekfetch.post(`https://discordbots.org/api/bots/${bot.user.id}/stats`)
.set('Authorization', 'secret shit')
.send({
server_count: bot.guilds.size
})
.then(() => console.log('Updated discordbots.org stats.'))
.catch(e => e);
@earnest phoenix
ye im gonna do that now then
i didn't look into snekfetch further after you recommended it
thought i'd first share the code
oke
thanks @topaz fjord that posted perfectly ๐
np
Who knows how to add footer to your websites twitter card? html
@lethal sun https://davidwalsh.name/twitter-cards
Question, @trim steppe (You approved my bot and so I assume you will be avaliable to answer a question)
Am I permitted to add things to my bot that depend on if the user upvoted my bot or not? (Like more money in daily or whatever)
What does it mean by RSV2 and RSV3 must be clear?!
you only get 1 credit unless you updoot in which case you get 600 credit /s
@lethal sun keep stuff easy on yourself: https://webcode.tools/twitter-card-generator
const update = () => {
const data = stringify({ server_count: bot.guilds.size });
const req = request({
host: 'discordbots.org',
path: `/api/bots/${bot.user.id}/stats`,
method: 'POST',
headers: {
'Authorization': 'API TOKEN',
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': Buffer.byteLength(data)
}
});
req.write(data);
req.end();
};
bot.on('ready', update);
bot.on('guildCreate', update);
bot.on('guildRemove', update);
still not displaying on site
oh lmfao
go generate an api token
i'm tired
and slap that sombitch on there
Hey @trim steppe Noticed you remove someones bot cause token on github whats that discord mamager thing you had open?
It's the online discord manager client
?
@trim steppe what's the link?
thanks
who owns @Phonecord
It's not here, so obviously nobody knows.
@topaz fjord ask your question here
Do you have anything showing what you're trying to do?
router.get('https://discordapp.com/api/users/'+data.clientid)
idk how to set an auth header
I've never used a get request like that, I don't think you even can.
Just use request to call it
Or you could even use snekfetch
But I perfer request.
But I perfer request.
router.get is for getting a request to your express server.
Is this for a bot to authorize or for a user that logged in with discord? @topaz fjord
For a bot token authorization
const request = require("request");
let options = {
method: 'GET',
url: `https://discordapp.com/api/users/${data.clientid}`,
headers: { Authorization: 'Bot BOT TOKEN' }
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
For auth bearer authorization
var request = require("request");
var options = {
method: 'GET',
url: `https://discordapp.com/api/users/${user.id}`,
headers: { Authorization: 'Bearer CLIENT Bearer' }
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
@ebon apex is there a way to do it asynchronous
Cause I need to fetch a certain thing from the Json data that comes back then I need to update my db with that data
Just use google to find out how to do a asynchronous get request in nodejs
could someone lend a hand with Reaction collector on assigning roles based on reaction.
easily the best use of my time https://i.imgur.com/DKw5gmv.gifv
My nub skills can't help me understand how 2 make a mention prefix
halp
if (!['---', config.prefix, `@Gamebot `].some(prefix=>message.content.startsWith(prefix))) return;
that I have rn
@mighty barn <@botid>
np
And no apparently it just takes the first 3 characters only as the prefix
wow
How to collect all the users that have reacted to a certain message? Yes, I have read the docs. No, I don't understand them. And yes, I am dumb.
Laungage: Javascript
Library: discord.js
there is the message.reactions functions, then map it and fetchusers
message.reactions.map(r => r.fetchUsers())
as far as I can think
that's a basic idea tho, you have to get the message u need
like message ids and stuff
How can I select from every row in a table, then update every row in that table in sqlite?

idk why I get this error?
@neon pasture "socket hang up", your internet probably died
ยฏ_(ใ)_/ยฏ
The only logical other reason that I can think of is that you are timing out
its JavaScript
wots js
yes
.
Can someone help me? I'm trying to see if the message contains a number. When I try to use js if(isNan(args[0]) return message.channel.send("You need a number for this") it says that isNan is not defined, isn't isNan a default function in javascript?
it's isNaN
Well
Got it to work
if(isNaN(args[0]))
Somehow didn't recognize it as a function
yeah you missed a closed bracket
parenthesis
Yeah
lol
are there any limitations for updating counts via the API?
yes, dont spam
Hello everyone!
I found something that might help a few people!
https://academy.learnstartup.net/p/BJ3p9G4-nW/writing-clean-asynchronous-code-in-nodejs/?utm_source=1
Im not 100% what it is, but it looks reallyyyyy good
@exotic girder how often is it recommended to post counts? every hour?
an active bot would be "spammy"
every 30 min?
anyone here use passport-discord?
yes
in the same place as your clientid and secret
as scope
or where you call authenticate
oke ty
passport-discord - Passport strategy for authentication with Discord (discordapp.com)
url = f"https://discordbots.org/api/bots/{bot.user.id}/stats"
headers = {
'Authorization': dbltoken,
'content-type': 'application/json'
}
payload = {
'server_count': len(bot.guilds)
}
async with aiohttp.ClientSession() as session:
async with session.post(url, data=json.dumps(payload), headers=headers) as dblpost:
print(dblpost.status)
Did you put your token for dbl where it says dbltoken
Lib: Discord.py
Requires: aiohttp
(NOTE: This code is inspired by @await self._dbl_post() , but uses the aiohttp approach, which is/seems to be faster)
Code:
import aiohttp
dbltoken = "token"
url = "https://discordbots.org/api/bots/" + bot.user.id + "/stats"
headers = {"Authorization" : dbltoken}
async def on_ready():
payload = {"server_count" : len(bot.servers)}
async with aiohttp.ClientSession() as aioclient:
await aioclient.post(url, data=payload, headers=headers)
async def on_server_join(server):
payload = {"server_count" : len(bot.servers)}
async with aiohttp.ClientSession() as aioclient:
await aioclient.post(url, data=payload, headers=headers)
async def on_server_remove(server):
payload = {"server_count" : len(bot.servers)}
async with aiohttp.ClientSession() as aioclient:
await aioclient.post(url, data=payload, headers=headers)
^ working code
Are you posting it on server join and on server leave
yes
Also, there should be an await
where
Language: Python
Lib: Discord.py
Requires: aiohttp
(NOTE: This code is inspired by @await self._dbl_post() , but uses the aiohttp approach, which is/seems to be faster)
Code:
import aiohttp
dbltoken = "token"
url = "https://discordbots.org/api/bots/" + bot.user.id + "/stats"
headers = {"Authorization" : dbltoken}
async def on_ready():
payload = {"server_count" : len(bot.servers)}
async with aiohttp.ClientSession() as aioclient:
await aioclient.post(url, data=payload, headers=headers)
async def on_server_join(server):
payload = {"server_count" : len(bot.servers)}
async with aiohttp.ClientSession() as aioclient:
await aioclient.post(url, data=payload, headers=headers)
async def on_server_remove(server):
payload = {"server_count" : len(bot.servers)}
async with aiohttp.ClientSession() as aioclient:
await aioclient.post(url, data=payload, headers=headers)
That
I think you missed something, lemme check docs
urs looks a little bit different than mine
But ye, mine works 100%
Youre saying its giving you 200?
yea
Is it giving you any json
no, i just made it print the status
async def fetch(session, url): with async_timeout.timeout(10): async with session.get(url) as response: return await response.text()
(Rip format)
But as you see, it uses await
If it doesnt use await, then it mught not work
So print(await dblpost) instead of your print might fix it
@agile basalt
