#development
1 messages · Page 498 of 1
im gunna go to sleep soon @paper zinc here is some usefull stuff once you install it
? what time is it in your country ?
sudo npm install pm2 -g
pm2 start blah.js
pm2 list
pm2 logs blah
pm2 stop blah
pm2 restart blah
america
ah ok
yeah go to sleep
OKAY THANKS
bonne nuit @earnest phoenix
bien ou bien moi sleep
I have a question regarding to wikipedia
bonne nuit!
should that command be NSFW since you can search for nsfw stuff?
if it has the possibility if outputting anything nsfw i would either filter the command or flag it as nsfw
check if the library you are using or api has a nsfw flag
if not i would mark it for nsfw
yea
flexes
@earnest phoenix you can use google custom search api and remove the safe search when the channel is nsfw
i just used the wikipedia api
some api's return nsfw without a flag or warning
/help
why wont this work for me
let tobe_translated = message.content.slice(prefix.length + command.length + 1)
What is html and Markdown
...
im sure you can figure that out..
No
Are u tryna slice [$use] blah
First word?
you can do this
Title
test
**
=== wew lad ===
**
Wew
Mais je peux écrire quoi
But what can I write?
this is my code, it wont work
exports.run = async(client, message, args) => {
if (args[0]) {
let from_language = "auto"
let to_language = "en"
let tobe_translated = message.content.slice(prefix.length + command.length + 1)
if (args[0].startsWith("from:")) {
from_language = args[0].slice(5)
tobe_translated = tobe_translated.slice(args[0].length + 1)
if (args[1].startsWith("to:")) {
to_language = args[1].slice(3)
tobe_translated = tobe_translated.slice(args[1].length + 1)
}
} else if (args[0].startsWith("to:")) {
to_language = args[0].slice(3)
tobe_translated = tobe_translated.slice(args[0].length + 1)
if (args[1].startsWith("from:")) {
from_language = args[1].slice(5)
tobe_translated = tobe_translated.slice(args[1].length + 1)
}
}
translate(tobe_translated, {
from: from_language,
to: to_language
}).then(res => {
from_language = res.from.language.iso
if (res.from.text.value) tobe_translated = res.from.text.value
final_text = res.text
let translateembed = new Discord.RichEmbed()
.setTitle("Translate")
.setColor("RANDOM")
.setDescription("Bip Bip Boop\nThe internet magic is here")
.addField("`from: " + from_language + "`", "``" + tobe_translated + "``")
.addField("`to: " + to_language + "`", "``" + final_text + "``")
message.channel.send(translateembed)
}).catch(err => {
message.channel.send(":x: Usage: `" + prefix + "translate [from:iso] [to:iso] <some text>` )
});
} else {
message.channel.send(":x: Usage: `" + prefix + "translate [from:iso] [to:iso] <some text>`")
}
}
oops
tu peux ecrire <h1>Ceci est un titre</h1> par exemple
</br> pour sauter une ligne
etc...
@earnest phoenix tu dois avoir ta description en tete, ce que fait ton bot etc..
apres cherche un tutoriel sur le net pour ecrire ton texte en html
Whats problem?
then why are you asking
On dbl?
Ok
Ok change the backround-image css variable then
..
Et c'est obligé de mettre Markdown
non html ou markdown
So like
What are you doing making a site if you dont know how css works xF
Gp to your main css file
Go into the body
And chance
Ok so go to your primary or last lpaded css file, add background-image into the body tag
let data = ops.active.get(message.guild.id) || {};
(node:6344) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'get' of undefined
help plz
@tame meadow with what
Bots coded in discord.js and it responds to any 2 character prefix, anyone know a fix?
im using a command handler btw
make it so it doesn't
you probably arent checking if the message starts with the prefix, and instead are just trimming the first two characters off the message and getting the command name (without checking the prefix first)
i was stupid once and did that 
HahaYes same
if i get a text like:
{"images":[{"startdate":"20181006","fullstartdate":"201810060700","enddate":"20181007","url":"/az/hprichbg/rb/SaltApple_EN-US13056568956_1920x1080.jpg","urlbase":"/az/hprichbg/rb/SaltApple_EN-US13056568956","copyright":"Apple tree on Salt Spring Island in British Columbia, Canada (© Radius Images/Offset)","copyrightlink":"http://www.bing.com/search?q=Salt+Spring+Island&form=hpcapt&filters=HpDate:"20181006_0700"","title":"Take your pick","quiz":"/search?q=Bing+homepage+quiz&filters=WQOskey:%22HPQuiz_20181006_SaltApple%22&FORM=HPQUIZ","wp":true,"hsh":"78f29b2b81afdbaa1a6527b3025bb5b4","drk":1,"top":1,"bot":1,"hs":[]}],"tooltips":{"loading":"Načítání…","previous":"Předchozí obrázek","next":"Další obrázek","walle":"Tento obrázek není dostupný ke stažení jako tapeta.","walls":"Stáhněte si tento obrázek. Můžete ho ale použít jenom jako tapetu."}}
How can I only get the url part?
language JS
{
"images": [
{
"startdate": "20181006",
"fullstartdate": "201810060700",
"enddate": "20181007",
"url": "\/az\/hprichbg\/rb\/SaltApple_EN-US13056568956_1920x1080.jpg",
"urlbase": "\/az\/hprichbg\/rb\/SaltApple_EN-US13056568956",
"copyright": "Apple tree on Salt Spring Island in British Columbia, Canada (\u00a9 Radius Images\/Offset)",
"copyrightlink": "http:\/\/www.bing.com\/search?q=Salt+Spring+Island&form=hpcapt&filters=HpDate:%2220181006_0700%22%22,%22title%22:%22Take your pick",
"quiz": "\/search?q=Bing+homepage+quiz&filters=WQOskey:%22HPQuiz_20181006_SaltApple%22&FORM=HPQUIZ",
"wp": true,
"hsh": "78f29b2b81afdbaa1a6527b3025bb5b4",
"drk": 1,
"top": 1,
"bot": 1,
"hs": [
]
}
],
"tooltips": {
"loading": "Na\u010d\u00edt\u00e1n\u00ed\u2026",
"previous": "P\u0159edchoz\u00ed obr\u00e1zek",
"next": "Dal\u0161\u00ed obr\u00e1zek",
"walle": "Tento obr\u00e1zek nen\u00ed dostupn\u00fd ke sta\u017een\u00ed jako tapeta.",
"walls": "St\u00e1hn\u011bte si tento obr\u00e1zek. M\u016f\u017eete ho ale pou\u017e\u00edt jenom jako tapetu."
}
}
so .images[0].url
Cannot read property '0' of undefined
code
.setImage("https://www.bing.com" + res.text.images[0].url) is what I used
res.text returns the text I showed you
for res.images[0].url same error Cannot read property '0' of undefined
That one works 😃 Thank you!
@vocal meteor active is not defined
or ops is not defined leading to active not defined
make sure ops is defined as a constructor, a variable holding a json format, or is a valid node require
at Object.module.exports.run (/app/commands/skip.js:13:18)
at Object.exports.run (/app/events/message.js:28:31)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
(node:13751) 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:13751) [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.
(node:13751) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'queue' of undefined
at finish (/app/commands/play.js:77:13)
at StreamDispatcher.<anonymous> (/app/commands/play.js:68:8)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:106:13)
at StreamDispatcher.emit (events.js:208:7)
at Object.module.exports.run (/app/commands/skip.js:23:30)
at Object.exports.run (/app/events/message.js:28:31)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
(node:13751) 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: 2)```
what does this error means
can you help me in fixing it
cannot read property 0 of undefined so probably u are trying to get [0] like an array of somethign that is undefined
i already said the issue here^
it tells you the line number in the error
play.js - https://www.hastebin.com/evibowuxad.js
queue[0] doesn't exist
in play.js or skip.js
in the only one that has it
just gonna assume that this isn't your code
^
`(node:266) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'includes' of undefined
at Object.module.exports.run (/app/commands/skip.js:15:28)`
something is undefined
no idea what property is
no idea what undefined is
doesnt know how to read error
cant figure out line number from error
classic DBL
a problem in my code that can help me
no tabs 
I have a question, every once in a while my bot console keeps having this error then it automatically restarts my bot
ECONNRESET, does this error mean that my internet has been reset and restarts my bot or is it something else?
replace the ( and the ) with { and }
you have message => ( ...)
replace it with message => { }
@obtuse wind it means there was a connection issue and your connection got interrupted
It doesn't mean its restarting
oh oof
@earnest phoenix paste this line instead?
bot.on('message', message => {
if (message.content === "ping"){
message.reply("pong");
console.log(`ping pong`)
}
});```
that's how it should be done
🥄 
not you
can't install snekfetch
probs cuz its deprecated
what i should do ?
install node-fetch
thats what it says
but
:yes
Will you test my Discord botum?
oh ok i see the field
thx
my bot is online but dbl is showing that it's offline. what do i do?
wait
and make sure its in the server
^
how do i add my bot to the server
*this server
t!davet
@earnest phoenix you fill out the form on the website
for adding bot?
i filled that one out
it's a problem in the code that can help me
read the error
it says that is the problem
.
can u not read or smth @earnest phoenix
or something idk
i read .-.
ok if you can read
@knotty steeple that link ain't working
fix the error ur self, its pretty self explanatory
i already made the bot smh
what
wtf are you talking about
@obsidian canopy
Anyone know why this code doesn't add the role to the user who runs it? (Node.js btw)
module.exports.execute = (msg, bot) => {
let args = msg.content.split(' ').splice(1)
let role_name = args.join(' ')
if(args.length <= 0){msg.reply('invalid usage'); return}
if(msg.guild.roles.find('name', `${role_name}`)) return msg.channel.send('That gang already exists! Whachu doin homie?');
msg.guild.createRole({
name: `${role_name}`,
color: `white`,
permissions: []
})
msg.channel.send(`Yo the ${role_name} gang has established themselves.`)
msg.member.addRole(msg.member.guild.roles.find('name', `${role_name}`))
}```
lib?
discord.js?
i only know how to use await in python so could you give an example?
or is it the same
just adding await before it
just write "await bleh bleh bleh"
the same
oOR
but await is easier
im not too worried about the easier way tbh
just add await before it, and add async before the (msg, bot) at the start of the function
thanks
yw
now to figure out json storage and how to store the creator of the role
@whole plume if I was you, I would use a database instead of saving your data in json.
dont feel like creating a database right now
simply because I dont have a way of doing so efficiently
you can use https://firebase.google.com/products/firestore/
@whole plume you use JavaScript right?
cant access it cause "google.com's ip address cannot be found"
and that'd be correct jeff
but my thing is I dont really have a good way to host it
both of my bots are running of the machine im on right now
I mean
or buy a vps
gigabit connection on an ssd with plenty of cpu and ram to go around
I do eventually plan on buying a vps or something but right now i'd rather just keep it as is
JSON is fine as long as you use the write-file-atomic package
regardless of writing the file properly or not, there's a point where json can't handle it anymore
and you're just wasting cpu with (de)serialization
@whole plume you can use OVH, their first plan is just $3/month
no ovh is shit from what ive heard
I use VPS cheap
!user
not common prefixs tho pls
hey, can somebody say to me, why I can't klick on 'Generate token'. on the API Page?
lmao
@vagrant kernel "why I can't klick on 'Generate token'. on the API Page?" - Simon | Player_Schark
If i hover with the mouse over the text it does not change its shape as it should normally do or?
@vagrant kernel try going to your bots edit page
Yw
my description is becoming a mile long and i dont know how i should format it to clean it up
any ideas?
no im not talking about problems with writing css and html
im talking about the amount of stuff needing to be written
oh wait
i didnt read link ignore me
mk ill just use better markdowns
<br>
Could someone list like 10 internet browsers here
doesn't have to be best - worst or fastest - slowest
just 10 different
would appreciate, anyone who does it gets a big star from me
this does not include browsers based on other browsers
Chrome
Opera
FireFox
Internet Explorer
Edge
Safari (Mac)
Tor
Maxthon
Netscape
and Slim
thanks @whole plume xo
np
chromium
this does not include browsers based on other browsers
i mean it's not really based on Chrome
but essentially it's the same thing
but thanks
so like
chromium is just the hipsters's chrome
tho edge is kinda based on IE too
yeah but it's become more of it's own browser
i use ie6
so like i can open IE and Edge on the same page but IE is fucked and edge displays it like chrome but with fancy scrolling
ive been web testing and my site looks trash on IE lmfao
lol
my website runs on modern frameworks not very compatible with ie :c
but whos uses ie
i agree
@languid dragon that list has at least 2 browsers based on other browsers
i wouldn't have a clue 
opera is based on chrome and tor is based on firefox
i have an iphone
oooo
can you go to https://discordbots.org/servers and test the mobile menu
k
thnx
iPhone 5?
yup
ok thank
yw
btw @languid dragon u might wanna make a seperate section for top discord servers since now only 2 show in the section lol
ill take it as a suggestion, thanks <3
Hey anyone knows channelUpdate event in discord.js how to use
<client>.on('channelUpdate', (oldChannel, newChannel) => {
})
ooh thanks @languid dragon
var channel = member.guild.channels.find(c => c.name === "logs")
const canvas = new Canvas(700, 250);
const ctx = canvas.getContext('2d');
const background = await Canvas.loadImage('https://discordjs.guide/assets/img/8CQvVRV.png');
ctx.drawImage(background, 0, 0, canvas.width, canvas.height);
ctx.strokeStyle = '#74037b';
ctx.strokeRect(0, 0, canvas.width, canvas.height);
// Slightly smaller text placed above the member's display name
ctx.font = '28px sans-serif';
ctx.fillStyle = '#ffffff';
ctx.fillText('Welcome to the server,', canvas.width / 2.5, canvas.height / 3.5);
// Add an exclamation point here and below
ctx.font = applyText(canvas, `${member.displayName}!`);
ctx.fillStyle = '#ffffff';
ctx.fillText(`${member.displayName}!`, canvas.width / 2.5, canvas.height / 1.8);
ctx.beginPath();
ctx.arc(125, 125, 100, 0, Math.PI * 2, true);
ctx.closePath();
ctx.clip();
const { body: buffer } = await snekfetch.get(member.user.displayAvatarURL);
const avatar = await Canvas.loadImage(buffer);
ctx.drawImage(avatar, 25, 25, 200, 200);
const attachment = new Discord.Attachment(canvas.toBuffer(), 'Welcome.png');
channel.send(`Welcome to the server, ${member}!`, attachment);
});
(node:6669) UnhandledPromiseRejectionWarning: TypeError: Canvas.loadImage is not a function
pls help me
i am using glitch but i never got this error
how to make a nsfw command in discord.py?
@austere sedge first you check if the channels is NSFW is_nsfw() (https://discordpy.readthedocs.io/en/rewrite/api.html#discord.TextChannel.is_nsfw)
If true: execute the command.
If false: send them an error message.
I almost never use Python, so please give me a minute or 2.
i see
@austere sedge that helped you?
yes
@vocal meteor
https://i.imgur.com/DKUUsu1.png
I have a weird issue
(Scala)
Error:
Type mismatch: found StringBuilder, required scala.reflect.CLassTag[String]
yeah I found the issue
I needed to put brackets on the relations map...
I!help
l!help
Deso
@inner jewel just realized what I did was stupid and I can just do this
.append(relations map {case (col, value) => s"$col = $value"} mkString ",")```
anyone here use canvas-constructor
Hello Iona Boy
You are a 8th std student ryt? Whom i saw being a help vampire in D.js n some server
Yes
Who Dosent accept to learn js
-bots @stable tide
@olive barn
-bots @earnest phoenix
@native fulcrum
My bot just reached 2,500 servers and I need to start sharding, however I keep getting the error
UnhandledPromiseRejectionWarning: Error: Shard 1's process exited before its Client became ready.
So anyone knows if its possible with nodejs+discord.js to export your full client with exports.client = client and require that on a different file thus having the full client there useable
Or does that break anything etc im not sure
Thought I'd just ask🤷🏼♂️
It does, but I wouldnt recommend that
I'd actually export a function in the desired file which takes a client as a parameter
I see alright thanks
@earnest phoenix you still here? If so I think I got it however..
When requiring the file containing the export for the client, it actually starts running the script aswell
Meaning for a moment you'd have two instances of the same client
Is there a fix for that?
Two instances of the same client?
Yeah
How are you applying this?
Well on the index file of the bot I just added a function that returns the client from there
Well I'll need more thatn this
exports.sendClient = function() {
return client;
};
My export function
Aaand
addUserBot(filename) {
console.log(filename);
const file = require(path.resolve('../'+filename));
console.log(file);
}
My function on a class that attempts to just require the file but automatically starts running it
That's exactly what I didn't want you to do :(
What do you mean?
Thought you intended to use an function on export
Lmfao my bad😂
Not in the main file. In the file that needs the client.
Oh and then require that function on the main file
And pass the client in it
OH lmaaoooo
Life struck me hard
But does that automatically give the input to the file it needs to be?
As far as I know it shouldnt..
Lets say I use that same function give it a param, and then require it on my bot file
Execute it pass the client to that function and make it return it
I still dont have it on my file I need it I believe then
And even then, the file im using it on is not constantly alive, so how would I do this?
i need help with my Bot (discord.ph)
The bot should only choose a person of a certain role.
Scaffolding is already standing but unfortunately I can not get the rest
Can someone help me?
What is discord ph?
php maybe?
JS question: any way to optimise this?
'help': (message: Message, input: string, parameters: string[]) => {
this.displayHelp(message, input, parameters)
},
If i pass the function as is:
'help': this.displayHelp
...the scope of this is not the proper one.
I tried setting const self: any = this and passing self.displayHelp instead but it still had the same scope.
t!ascii sa
its fine
@lucid iris this.displayHelp.bind(this)
i mean python
(node:7844) UnhandledPromiseRejectionWarning: Error: Client network socket disconnected before secure TLS connection was established
at TLSSocket.onConnectEnd (_tls_wrap.js:1086:19)
at Object.onceWrapper (events.js:273:13)
at TLSSocket.emit (events.js:187:15)
at endReadableNT (_stream_readable.js:1092:12)
at process._tickCallback (internal/process/next_tick.js:63:19)```
Wots this
Not sure. you mightve have wrote something wrong in the startup of your bot
not related to code
what im getting from the error is that the client got disconnected before it could connect but idk
and Im getting this error too (node:1128) UnhandledPromiseRejectionWarning: Error: connect ETIMEDOUT 104.16.58.5:443
.bind(this) works wonders; thanks, @inner jewel
-bots
This user has no bots
XD
Ask your question
i need help with my Bot (python)
The bot should only choose a person of a certain role.
Scaffolding is already standing but unfortunately I can not get the rest
Can someone help me?
how do you make a bot account?
Step up your game with a modern voice & text chat app. Crystal clear voice, multiple server and channel support, mobile apps, and more. Get your free server now!
yeah the client id apparently is wrong
what
ok so
are you logging into the Bot
With the client id?
cause
if u are
bad
Unable to fetch application. Make sure you've provided the correct Client ID and that the application has a bot account.
this is what i got
im getting into discord.py development but im running into an error im completely new to python can someone lend a hand here https://hastebin.com/otidopufiy.coffeescript
I think you forgot to create a bot user
how do you do that?
there's a Bot tab on the left
where at?
the developers website
in your application page
the developer portal?
yes
yes
how do i create a bot user?
literally on there
aha!
can anyone make a html code that makes my discord bot page backround a dark red?
body {
background-color: crimson;
}```
Dear ppl, I have python and I copy pasted the example.
I have my bot running for 2 days with it now.
But it doesn't update.
Is there something else I have to do? Except copy paste the example to update the server count (it now is NA)
Almost
For that html code
Use
<html>
<head>
<style>
background-color: crimson;
</style>
</head>
<body>
</body>
<html>
no
Yes
dont use html and head
because the html is being injected into an existing page
it already has its own html and head
adding more html and head tags is wrong
my cert?
ye
what do you mean
lmao
the discord overlay is broken for colors
?
But not the answer
what are you sayin?
you only need <body> and <style> afaik for dbl long desc
^
You used css
yes
style is inline css
Yes I know
I KNOW BUT THATS NOT THE FUCKING ANSWER
dont use html tag
it is if you know how to use inline css
Chill
lol
Jesus fuck
i love when people ask for me to write code
then get mad
when they cant use it
propperly
wew
thats their problem, and they will figure it out eventually, or ask again for help
technically, you presented a solution, yes, but a bad one
lmfao
lol
But okay I had question to
Spammed away
Dear ppl, I have python and I copy pasted the example.
I have my bot running for 2 days with it now.
But it doesn't update.
Is there something else I have to do? Except copy paste the example to update the server count (it now is NA)
are you talking about the dbl api?
yes, you need to post the server count
Yes, but idk how.
I copied that example
But that didn't did anything
I have it running for 2 days with that now
And still didn't updated.
then you did something wrong. if it works, it takes 5 seconds to update
Yeah it's the example hold on
Token is hidden
I don't need it, I need it to post
I do know I am in 700+ servers
are you now?
wait you are in 700 severs?
Over
shhh
Yes
I thought the limit was 100
wat
ok
what limit?
oh lmao
xD
hes talking about his bot
gotem
I know
did we just get bamboozled
ye
wait
no
you dont just not know how to write css and python and be in 700 servers with your bot
unless its not his

#Importing libraries
import discord
from discord.ext import commands
import dbl
import time
import random
import pickle
import re
import aiohttp
import asyncio
import logging
class DiscordBotsOrgAPI:
"""Handles interactions with the discordbots.org API"""
def __init__(self, bot):
self.bot = bot
self.token = 'HIDDEN NOW' # set this to your DBL token
self.dblpy = dbl.Client(self.bot, self.token)
self.bot.loop.create_task(self.update_stats())
async def update_stats(self):
"""This function runs every 30 minutes to automatically update your server count"""
while True:
logger.info('attempting to post server count')
try:
await self.dblpy.post_server_count()
logger.info('posted server count ({})'.format(len(self.bot.guilds)))
except Exception as e:
logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
print("updated")
await asyncio.sleep(300)
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(DiscordBotsOrgAPI(bot))
I do know how to write CSS, but he asked for html not css
I am not perfect
I am human
So yes I can have questions
"ye
wait
no
you dont just not know how to write css and python and be in 700 servers with your bot
unless its not his"
well, im not a python dev. but does it have any error? does it show "attempting to post server count" in the logs?
Ah
im no pro at python so i couldnt tell you whats wrong with what you have but that idea is pretty universal
i think the function is already being called at the end of the code
but its using bot as input
Yes but now I had it reffered
I know
But I didn't reffered
But how to refer a class
And what should be "self"
you can always POST it yourself
without the library
do you know how to create an http POST request?
its just like using a REST API
thats what i do
"Failed to post server count
Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}
Traceback (most recent call last):
File "/Users/Zl109819/Documents/PythonBot/Bot.py", line 167, in update_stats
await self.dblpy.post_server_count()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/dbl/client.py", line 100, in post_server_count
await self.http.post_server_count(self.bot_id, self.guild_count(), shard_count, shard_no)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/dbl/http.py", line 189, in post_server_count
await self.request('POST', '{}/bots/{}/stats'.format(self.BASE, bot_id), json=payload)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/dbl/http.py", line 160, in request
raise Forbidden(resp, data)
dbl.errors.Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}"
Well it least it says something now
Before I didn't said something
good, now you're getting somewhere
Errorsolving is hard
status code 403 is access forbidden
IDK what that does mean
the js library had the same problem some time ago, thats why i used a manual post request instead
post it in the #topgg-api channel, maybe someone knows how to fix
I did, thnx
I have a problem in my code
this is the discord for poke plug right?
Or remove var
nvm wrong
I have a problem in my code
var msgauthor = message.author.id;
if(message.author.bot)return;
if(!db.get("xp").find({user: msgauthor}).value()){
db.get("xp").push({user: msgauthor, xp: 1})write();
}else{
var userxpdb = db.get("xp").filter(user: msgauthor}).find('xp').value();
console.log(userxpdb);
var user = Object.values(userxpdb)
console.log(userxpdb);
console.log(`Nombre d'xb: ${userxpdb[1]}`)
db.get("xp").find({user: msgauthor}).assign({user: msgauthor, xp: userxp[1] += 1}).write();
if (message.content === prefix + "xp"){
var xp = db.get("xp").filter({user: msgauthor}).find('xp').value()
var xpfinal = Object.values(xp);
var xp_embed = new Discord.RichEmbed()
.setTitle(`Stat des XP de ${message.author.username}`)
.setColor('#013ADF')
.setDescription("Affichage des XP")
.addField("XP:", `${xpfinal[1]} xp`)
.setFooter("Enjoy :p")
message.channel.send({embed: xp-embed});
code block please
also your error is probably not there
it says bot has already been declared
that means somewhere in your code you have const bot = something twice
its in line 11
it says what the error is
doc.js line 29, missing a )
but in your case, it doesnt find the ) because there is a } in front of it without a { existing
Using Python
async def googlesearch(args):
try:
from googlesearch import search
except ImportError:
print("No module named 'google' found")
stringnumber = (args.split(", ")[1])
stringquery = (args.split(", ")[0])
# to search
query = str(stringquery)
for j in search(query, tld="co.in", num=float(stringnumber), stop=1, pause=2):
await client.say(j) ``` gives me this error: ```Ignoring exception in command googlesearch
Traceback (most recent call last):
File "/home/runner/.site-packages/discord/ext/commands/core.py", line 50, in wrapped
ret = yield from coro(*args, **kwargs)
File "main.py", line 82, in googlesearch
stringnumber = (args.split(", ")[1])
IndexError: list index out of range
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/runner/.site-packages/discord/ext/commands/bot.py", line 846, in process_commands
yield from command.invoke(ctx)
File "/home/runner/.site-packages/discord/ext/commands/core.py", line 374, in invoke
yield from injected(*ctx.args, **ctx.kwargs)
File "/home/runner/.site-packages/discord/ext/commands/core.py", line 54, in wrapped
raise CommandInvokeError(e) from e
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: IndexError: list index out of range```
what it basically does
I type in the command along with what i want to search
and then a comma followed by a number
How would I get the key with the highest value in an object..? I'm guessing using filter but I'm not sure
Yeah the value is a number and what does entries give you
Could I do something like this..?
Object.keys(obj).reduce((a, b) => obj[a] > obj[b] ? a : b);```
i dont have much experience with reduce, but i believe so yes. idk if its better than filter tho
reduce((a, b) => a[1] > b[1] ? a : b)[0] on the entries
and if you use entries instead of keys, you dont need to access the main object on every loop
True
doing this with filter would be... painful
is filter more expensive?
you'd need to iterate at least twice
what about sort?

I barely know thse functions
lol
(node:7744) UnhandledPromiseRejectionWarning: TypeError: Cannot convert undefined or null to object
Does this happen if the object is empty?
yup
I have a bot using Discord.js-commando where can I change the prefix
and I don't want to use ! because it can interfere with other bots if you use it with multiple bot
s
what is your bots name?
Discord Upgraded
I was just thinking about that!
du.help also would work
or maybe just DU
should I delete discord.js?
so your putting a space between your prefix and command
dont pu ta space
unless you have a space specified
in your prefix
I have a space is my prefix
if(typeof options.selfbot === 'undefined') options.selfbot = false;
if(typeof options.commandPrefix === 'undefined') options.commandPrefix = 'DU ';
if(options.commandPrefix === null) options.commandPrefix = '';
if(typeof options.commandEditableDuration === 'undefined') options.commandEditableDuration = 30;
if(typeof options.nonCommandEditable === 'undefined') options.nonCommandEditable = true;
if(typeof options.unknownCommandResponse === 'undefined') options.unknownCommandResponse = true; ```
see
there's a space in DU
it may be a problem with how it parses it
like if it splits it into an array and selects the first element to determine command
like i do
then space would not work
try removing the space
use the bot, and if it works
hrm ok
that was when I had ! as my prefix
i dont know dj commando well enough on how it functions to help you futhur with that
i would check hot it parses the message to determine the command being used
or if its loading the commands propperly
also make sure you define the commands correctly etc
ok
also this is somehow not working
class CoinFlipCommand extends commando.Command
{
constructor(client)
{
super(client,{
name: 'flip',
group: 'simple',
memberName: 'flip',
description: 'Flips a coin, landing on either Heads or Tails'
});
}
async run(message, args)
{
var chance = Math.floor(Math.random() * 2);
if(chance == 0)
{
message.reply("Your coin landed on Heads!");
}
else
{
message.reply("Your coin landed on Tails!");
}
}
}
module.exports = CoinFlipCommand; ```
I don't know what I did wrong
I fixed the errors! I forgot to register stuff in index.js
Anyone have a bot with economy and mod
@limber sphinx
What is its prefix xd
! by default
Ok
go to https://unb.pizza
also
this channel is for coding help
Hi I'm looking for a game of thrones conquest bot
Yo homies
I'm coding In C#,
How would I find the current voice channel of the user who did the command?
working on my bot in discord.js-commando
I made a coin flip command, fortune, random number, and dice roll
xD
What is wrong with commando? @bright spear
well
people pretty much only talk about commando to say its bad
ive never really tried it
i use Spark
oh
commando is basically a library that acts as a template
I use both discord.js and I also have discord.js-commando in node_modules
commando instantly gives you a help command with the prefix !
spark is also a framework for discord.js
never tried spark
I love commando
it is very useful
Well, I am going to go, I have school in the morning.
:kotlin:
How was the google bot violating tos? @potent frost
@wheat marten privacy invasion
Oh
I have a problem in my code
What's iyour code
});
here is the mistake. I use google translation I am french
@bright spear
I have a problem in my code
That just means there's a mistake somewhere before that
running code on your phone
const dbl = new DBL(config.dblToken, { webhookPort: 5000, webhookAuth: 'password' });
do i put my auth code in the password bit?
oh ok i just got an error since it cant send a message to that user
which is a bit gey
guys how do I send contents of an ascii file for ga!help command
this isn't neat
or just a txt file
ascii file is just an ascii encoded txt file
ik but i showed him asciidoc but he taught it was a file
isnt an asciidoc file still a plain text file
If anyone knows how to make (Or knows of an existing bot) some version of a Support bot that can PM users with a role (Like admin/moderator) when someone enters a Voice channel like a Helpdesk, please feel free to PM me sometime. Thanks.
this isnt #request-a-bot @warm bronze
help
the bulkDelete command is a thing
but it's saying it's not now
it was working before
oh ok thanks
HELP ME
I'VE RESET TOKEN LIKE 5 TIMES ALREADY
AND PUT NEW TOKEN IN
IT AIN'T WORKING ;-;
nvm realized I was tryna put in my bot secret instead of my token lmao
why does it print bot online if it didn't connect to discord cause of incorrect token
do it in connect event 
ye I will
Make sure it isn't the client secret
make a db and make custom settings
@lament meteor If I were to make a database should I use Firebase?
idk
there are many databases you can chose from
simple ones like sqlite and leveldb, or more complex ones like mysql, postgre, rethink, mongo
it depends on your needs, and how big your bot will get
if your bot gets over 2500 servers and you start sharding, you will need a database that accepts multiple connections
is there anyone that knows the code of setting slowmode with discord.js
On master it's https://discord.js.org/#/docs/main/master/class/TextChannel?scrollTo=setRateLimitPerUser, it's not in stable yet
thank you
Doing it wrong then
Does it give an error?
You should add a .catch, it's a promise
Try it?
its still not working
TypeError: channel.setRateLimitPerUser is not a function``` @earnest phoenix
@glacial sentinel You can use one of the handy libraries on NPM for that ^^
Add rewards for the votes for example
Automating it would be a better deal 

.
@gleaming glen I'll try when I get home since i use master
See if I get the same thing
okay, thx 
@earnest phoenix minutes is undefined
Hi guys
Help with Webhooks at https://discordbots.org
#topgg-api would be a more appropriate channel for that
He posted that in api already
@gleaming glen yeah i get it also lol https://i.imgur.com/ysAMPLo.png
can confirm https://sharon.isabad.host/i/trlza.png
u on master?
how
hi
🖕
oh
@west raptor
huh
Tu parle francais
no
Is NSFW commands against discord ToS?
@wheat marten as long as it is in an nsfw channel, no
ok
Thanks
I am just making sure that I don't break Discord's ToS because I am planning on adding NSFW commands to my bot
glitch flipped the switch on my bot, blew it all away
I have it up on github so it's not a total loss, kinda sucks though
dont use glitch then
granted that's what I'd do if I were them
i heard it should be fixed now
What would I have to do to make economy commands for my bot
should I use discord-eco?
@wheat marten why dont you just code it yourself instead of using a package that does it for you






