#development
1 messages Β· Page 422 of 1
Im a normie
Lol
pojdaspodjpasodjpa
lol
Fk it i'm switching to js for now
xD
Ladineko uses py I think
xd
wait you can add your bot here right?
Yea.
https://discordbots.org/newbot i forgot the link but iirc it is that
Bascially, sharding splits the bot into different instances, each instance controlling a group of guilds (Up to 2500 per shard), I guess the connected would mean that that instance of the bot (shard) is running
But you need to approve it.
It needs to have commands and it needs to work
I mean, it needs to be appove*
And be online mostly.
and a help command
Bot Rules in #rules-and-info
oof
thanks for the help
cya o/
Bye.
tbh py and js has their differences and they are both good so dont say js is better than py or yea.....
Doesn't Partner Bot use dsharp?
idk
Yeah it does
it does
@earnest phoenix whats up with python?
Does anyone use Heroku for their bot deployments / other apps?
but everytime I run it there's a message in the log
Failed to load extension ()
()
Failed to load extension ()
()
Failed to load extension ()
()
Failed to load extension ()
()
Failed to load extension ()
()
Bot online
@earnest phoenix
Ok
You using cogs i assume?
Cogs?
Ye to load your modules/extensions
if __name__ == "__main__":
for extension in startup_extensions:
try:
bot.load_extension(extension)
except Exception as e:
exc = '{}: {}'.format(type(e).__name__, e)
print('Failed to load extension {}\n{}'.format(extension, exc))
pip install youtube_dl?
yeah I have that code atm
Ok
from discord.ext import commands
from discord.voice_client import VoiceClient
startup_extensions = ("Music")
bot = commands.Bot("")
@bot.event
async def on_ready():
print("Bot online")
class Main_Commands():
def __init__(self, bot):
self.bot = bot
@bot.command(pass_context=True)
async def Minri(ctx):
await bot.say("He doesn't know what he's doing")
@bot.command(pass_context=True)
async def Help(ctx):
await bot.say("```Commands... I don't know huehue```**gonna switch to javascript for now huehueh cya later**")
if __name__ == "__main__":
for extension in startup_extensions:
try:
bot.load_extension(extension)
except Exception as e:
exc = '(): ()'.format(type(e).__name__, e)
print('Failed to load extension ()\n()'.format(extension, exc))```
Do you have a list of modules you wish to load?
failed code block
Where is your startup_extensions?
oh wait there
Music
ok
Do you have a file named Music.py in the same folder?
yes
The odd thing here is that you are loading 5 empty ones O_o
nani
what do you mean
Failed to load extension ()
()
Failed to load extension ()
()
Failed to load extension ()
()
Failed to load extension ()
()
Failed to load extension ()
()
Bot online
So I should delete something?
Is your code on a github or something?
Got it from YetiGuy!
Oh dear
Copy pasta
so you just dowloaded someone else's project?
Thats where most issues begin π
As you never know what its build as π
he showed how to do it but didn't show how to do the music.py file
wait
So i'm kinad confused where to search
what bot is that event?
Ok, lets start with the documentation
oki oki
https://gist.github.com/leovoel/46cd89ed6a8f41fd09c5
Here is a example of using cogs
discord.py's basic_bot.py converted to use "cogs".
Try comparing your code with this
oki oki
I started with this code. (bot.py) and rebuilded it to my own later on once i understood it π
ooo oki oki
thank you ^-^
Did you get it to work?
Just PM me if you have any more questions π
I don't always check #development
@humble gyro Here's an example command for my thingy
public class CommandAddTwo extends CommandImpl {
public CommandAddTwo() {
super("add two");
super.setDescription("Add two integer numbers together and get the result");
super.setAliases("addtwo", "at");
}
public void onCommand(MessageReceivedEvent event, CommandEvent commandEvent, @Argument(description="number 1") int num1, @Argument(description="number 2") int num2) {
event.getChannel().sendMessage((num1 + num2) + "").queue();
}
}```
Don't want to spam general
good idea
oh cool
I'm building something experimental like this
which will be like
I might also add a feature so that they can hotswap commands (By recompiling and reloading classes)
[Command("add")]
public Task Add(EventContext context, int numA, int? numB = null)
{
context.Channel.Send(numA + numB ?? numA);
}
and then it'll just check if the arguments will automatically fit
Wish you could do that in Java
you probably can
I haven't seen anything about it in the 4 years I have been using Java xD
pretty sure it's possible tho
Doesn't seem like it
xD
Which one did you think I meant?
you can do it like this
class Nullable<T> {
bool isInitialized = false;
T value;
T Get() {
if(isInitialized) return value;
return null;
}
void Set(T value) {
this.value = value;
isInitialized = true;
}
}
...
public void DoThing(int one, Nullable<int> two) {
int return = one + (two.Get() != null) ? two.Get() : one;
}
@native narwhal
I am here π
I know I can and I have already implemented something like that (Another example)
public class CommandAvatar extends CommandImpl {
public CommandAvatar() {
super("avatar", ArgumentFactory.of(User.class).setDescription("user").setDefaultValue(event -> event.getAuthor()).build());
super.setDescription("Get the avatar of a user");
}
public void onCommand(MessageReceivedEvent event, CommandEvent commandEvent, User user) {
event.getChannel().sendMessage(new EmbedBuilder().setImage(user.getAvatarUrl()).build()).queue();
}
}```
Default value can either be a lambda or a direct value
It just gets annoying with multiple arguments doing that π
And yeah it does
Maybe you got some ideas from my examples >:P
I meant for the concept π
you could make a global default maybe
just as a generic default
I am just trying to think of when you would acutally need to have a global default
if you don't like nulls that is π
globals are b a d
There are argument checks so unless one of the argument's default value is null the argument won't ever be null
Made a pretty extensive argument verifier
Basically if an argument has a default value it is considered optional otherwise the user must give that argument when they trigger the command
@worn sparrow It's not a static
basically as in
ArgumentType.FromType(User).SetDefault(event -> event.author);
and make that apply this for all other factories on create
You can also add your own classes to the ArgumentFactory
Which is pretty neat
By default it supports all primitve data types, String, Enums and the Member, User, Role, Emote and TextChannel classes
Is there any way to actually catch this kind of thing (outside of catch_me btw) ? π€
function catch_me() {
return new Promise( () =>
setTimeout( () => {
throw new Error('Catch me Babe');
}, 1000)
);
}```
bc there would be a resolve in the settimeout ^^
But I simplified his in my testings
what are you trying to achieve though 
@halcyon abyss What about this? https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch
very confused
Catch don't catch π¦
so when you do catch_me() you want to catch the error that it makes?
yup
.catch should work
Well it doesn't x:
provided you have reject() and resolve() set properly
It works if I throw the error outside of a settimeout
"The catch() method returns a Promise and deals with rejected cases only."
you need to make a rejection in that promise
and throw the error
function catch_me() {
return new Promise( () => {
throw new Error('Catch me Babe');
/*setTimeout( () => {
throw new Error('Catch me Babe');
}, 1000)*/
});
}```
This would work
Ah
hu
but i can't
I just wanted to do some clean eval cmd for myself
So the function is kind of unknown
And I wanted to cover every possibilities
Well I knew I could do this, but I wanted to execute catch_me() without knowing its content, considering it may be wrong, lead to anything and still catch it
too bad, I'll probably leave it as is
you can make that an async promise
and use a sleep wrapper instead
of setTimeout
so you will execute it in the same context after 1s
yeah but that once again implies that I know the content of catch_me(). The idea was to not be able to change it's content
bc it's given as is
Yeah i like useless and mind fucking problems
π
doesn anyone know the structure of embed footers in Eris? (nodejs)
didnt know, thank you ^^
Embeds are provided by Discord, not by the libraries
The libraries only make you able to interact with the embeds
I meant the attribut names, I didnt know it was the same for all, since each library implements discord stuffs in different ways
I do, I learnt from reading the code xD but there is nothing about the footer ^^
yey
Eris
I use Discord.js and I use RichEmbeds, it's usually .setFooter(string)
He needs for eris
Should be similar for RichEmbeds in Eris
They're both js libraries
there is no RichEmbed class x)
.setTitle(myTitle)
.setImage(imageURL)
msg.channel.send(embed)```
I prefer eris for voice.
Something like that
That would send an embed with a title and an image
It's pretty easy to customize richembeds that's why I use them in djs
if (msg.content === "!embed") { // If the message content is "!embed"
bot.createMessage(msg.channel.id, {
embed: {
title: "I'm an embed!", // Title of the embed
description: "Here is some more info, with **awesome** formatting.\nPretty *neat*, huh?"
, author: { // Author property
name: msg.author.username
, icon_url: msg.author.avatarURL
}
, color: 0x008000, // Color, either in hex (show), or a base-10 integer
fields: [ // Array of field objects
{
name: "Some extra info.", // Field title
value: "Some extra value.", // Field
inline: true // Whether you want multiple fields in same line
}
, {
name: "Some more extra info."
, value: "Another extra value."
, inline: true
}
]
, footer: { // Footer text
text: "Created with Eris."
}
}
});
}
Here is an example ^
Yeah there's a way of doing that in djs
It looks ugly imo
So I prefer RichEmbeds
lol
thanks bolt ^^
I don't like richembed class
Well. Class is organized
There are tons of method to create embed in d.js
yeah
Without class too.
So ye.
If you like class use class, if not use other methods out there.
Hi, Tonkku
well i know, obv you can 
I just don't like it beeing in the lib built in function tbh but that doesn't really matter. And you can just create your own embed builder if you really like it's super simple
make your own richembed class for eris 
^
i would try
but cba
itβs already easy for me with embeds
that's why I prefer Eris, I feel more comfortable customising stuffs with it
maybe that's a dumb reason
Commando is full of useless thing
just build up your own command handler
I never had uninstalled any npm module so quickly
discord.js has better docs
Easy to understand.
that's true for the docs tho
Well. It is better in most of the things.
eris docs are just the code comments lol
lol
not better in lot of things. It's built to be user/noob friendly 
Everyone has their own opinions.
indeed
Btw I have a general question
Sure. Please go ahead and ask it π
How do some bots create profile cards for each user
Ofc not.
They use canvas.
@earnest phoenix actually it creates for each user
Well I know it's not through a discord library
Package.
But are there any libraries for such
any image manipulation library can do that
I use canvas
Text variables and all that?
Works pretty good fore me.
Sure.
You can do that all.
Do you recommend any
Lib
Which lang?
Javascript
(Node)

Discord.js?
I meant image manipulation libs
I'm using djs
Canvas π©
canvas is what I use
I said canvas.
Lol
Is that on npm
Oh
Yes.
Thanks
No problem.
I thought you meant smth like html canvas
xD
It's a thing lol
Don't blame me

Ik
no
just no
canvas-constructor
canvas is canvas-constructor
canvas-constructor is well well better
ask anybody
^
Ik
Anyone handy with git? Is there an npm package I can use to automatically tag pushes to master?
no....
you guys are wrong...
canvas is what canvas-constructor works on
using plain canvas is like sending embeds in a json format and using canvas-constructor is like d.js richembed builder
π€¦
Actually @lament meteor, its messageEmbed builder
@gusty topaz tru...
but Rph they think that canvas-constructor doesnt need canvas xD
I just read some of the canvas-constructor docs on npm and it seems like it requires canvas to work
I think canvas-constructor purpose is to make it easier to manipulate images
Using canvas as a source
Yeah
It reminds me
My question is do I still need to require Canvas in order to use canvas-constructor?
Or do I just need to install it
They don't mention it on the docs, at least I didn't see it
i doubt you need to
opsakdopsak
i dont think so cause York is smart
but i use raw canvas. no bulli pls i like spaget code

is there a way to message the person if he/she leaves a server?
@inner jewel btw nice taste on that pfp 
Yes
check docs for addMember or something
@earnest phoenix
:^)
heyy lad :}
Check the on_member_leave() and on_member_remove() events
they both have member as parameter
Depends on library
You can use that to send a message to that person
On djs it's something like: client.on("guildMemberAdd", () => {
ohhhh
arigato
She uses discord.py
π
Rip
Hap"py"
I'm a dude
lol

We don't judge...
Ive heard on the radio here in NL they want to make everyone 'Gender-neutral'
.>
trap
Chance of x and y chromosomes to find your gender
gender() {
const wantedToChange = this.wantsToChangeGender;
this.wantsToChangeGender = false;
return (this.gender ? (wantedToChange ? this.gender = randomGender() : this.gender) : this.gender = randomGender());
}```
nice
Gender == A very hard mathmatic calculation
Maffs
All of us were a female fetus
we got nip nips
Anyways, enough with the #memes-and-media :P
Back to the development
both?
But yeah, try playing with on_member_join(member) π
is there a way to alternate this code
import discord
import asyncio
client=discord.Client()
@client.event
async def on_ready():
print('logged in as')
print(client.user.name)
print(client.user.id)
print('-----')
newUserMessage = """ yea a message, ***Why U leave***
"""
@client.event
async def on_member_join(member):
print("Recognised that a member called " + member.name + " joined")
await client.send_message(member, newUserMessage)
print("Sent message to " + member.name)
role = discord.utils.get(member.server.roles, name="Loli Member")
await client.add_roles(member, role)
print("Added role '" + role.name + "' to " + member.name)
client.run('hehe private')
rather than join message you get a leave message
@client.event
async def on_member_remove(member):
^
There are pretty much events for almost everything
arigato
^^
again
Remove as in : gets kicked / banned / leaves
removed from guild
so i am getting a DiscordAPIError Missing Access error now out of no where what is it and how can i fix this.. discord.js lib
Make sure your bot has permissions.
permissions to what exactly?
it didnt happen until it was approved here
Guys
Anyone know how to make bot to send message to owner?
For example
!report Bug
I use python
Sure.
https://cogs.red/cogs/
lots of cogs here
so @earnest phoenix what permission would i need to do and would it have to be in my invite link?
sorry for the ping by the way
@tardy hatch owners are received trough the guild system.
ctx.message.guild.owner
*i want to set to message bot owner, ffs
Try giving admin perimissions
As for now.
If it doesn't throw error again, means the bot wasn't having sufficient permissions
ahh i see thank you
@bot.command(pass_context=True)
async def chat(ctx, *, message: str = None):
await bot.send_message(message)
await bot.say("__Message sent to BOT__\n{}".format(message))
await bot.add_reaction(ctx.message, "β
")```
Here
At bot.send_message
How to set user to be owner id
Because you are not a moderator.
Missing Access is lack of permissions, and bots do not have any permissions on this server.
is there any way i can get it off this server so it stops crashing my bot
just properly handle it
I am not a js coder. Use an if check for this server.
owner = bot.get_user(id)
or properly fix your code so it doesn't error
I am not getting what you are trying to achieve here..
You want to message the guild owner?
or message it to you?
bot.send_message(owner, "hi")
@tardy hatch
@earnest phoenix Them.
You want the bot owner?
Me? I want to help this poor guy but I think I will only confuse everyone here. 
He wants to basically message the bot owner
Brb Imma find that thing in my code to get a bot owner (an application owner).
it's not trouble to just use the get_user function
I guess it's easier to fetch an application owner, but whatever. 
I would personally like to see that code
@floral stone
Ignoring exception in command chat
File "/usr/local/lib/python3.5/dist-packages/discord/ext/commands/core.py", line 50, in wrapped
ret = yield from coro(*args, **kwargs)
File "bot.py", line 182, in chat
owner = bot.get_user(254198214415220738)
File "/usr/local/lib/python3.5/dist-packages/discord/client.py", line 296, in getattr
raise AttributeError(msg.format(self.class, name))
AttributeError: '<class 'discord.ext.commands.bot.Bot'>' object has no attribute 'get_user'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/discord/ext/commands/bot.py", line 846, in process_commands
yield from command.invoke(ctx)
File "/usr/local/lib/python3.5/dist-packages/discord/ext/commands/core.py", line 374, in invoke
yield from injected(*ctx.args, **ctx.kwargs)
File "/usr/local/lib/python3.5/dist-packages/discord/ext/commands/core.py", line 54, in wrapped
raise CommandInvokeError(e) from e
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: '<class 'discord.ext.commands.bot.Bot'>' object has no attribute 'get_user'
owner = bot.get_user(254198214415220738)
I have this
Ffs
I want to message bot owner (me)
owner = await bot.get_user_info('254198214415220738')
^
ew
3.5 all the way. 
3.6 is best
if ur a beginner start with latest stable imo
3.5 is unroundable. 
f'not really'
Sololearn explains everything with activities and such
I recommend it
It helped me
I personally learned python in sololearn, 100% would recommend to others
@tardy hatch
It didn't help me.
I never used it!
yes
Better not get caught on spam. 
that's why you recommend them docs for the language instead
sololearn does not teach everything
@floral stone i solved..
But it teaches you the basics
Practice is the best teacher.
I know a part of python
@tardy hatch please, can you at least learn the basics of python? if you are gonna write a bot, you have to at least know what you are doing yourself other than just copy example codes and hope for the best
^
This applies to everything outside of bots as well
if you're not going to learn the language so you don't have to ask a million questions about incredibly basic things, don't fucking bother
inb4 he comes back tommorow asking a question and ignoring what we said
I can see that coming.
Copy pasting code from github 
Copy pasting code from github without knowing what it does



@shy verge Thanks for reccomendation of using newtonsoft, its great
:D
@uncut slate fix the problem
[sorry ping]
what's your bot's ID
use a different channel next time
I need help
for python
if anyone is online
async def ban(ctx, userName: discord.User):
admin = has_role("Loli King")
await bot.ban(userName)```
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'has_role' is not defined
Anyone have any easy code that I can steal where if a user joins the support discord it'll give them a role if they own any servers the bot is in?
you're looking for something like userName.has_role
no spoon feeding
Sorry daddy donkku
no
I'll go back to my hole then
just use a simple @slim heart onGuildMemberJoin
yeah
Ohhhhhhhhh
ikik but like stiiiilll
lol it's fast
Why do people use this for getting help with d.py
Why not be normal and yaknow, go to the support discord
Because why not. 
w
erm for some reason when i forEach my guildlist, it returns that it cant read guild.owner.id but it can read guild.owner but when i array guild.owner it does have the id property...
if(!member.guild.id == "399688888739692552") return;
var guildList = bot.guilds.array();
console.log("checking")
guildList.forEach(guild => {
console.log(guild.owner.id)
if(member.id == guild.owner.id) {
console.log("oof")
}
})
});```
nvrm
Its because of servers like this with no guild owner lmaoo
This server does have an owner it's just that some libraries, especially discord.js, seem to have problems with it
@slim heart use .ownerID and fetchMember if you want anything more than the id
I've already figured it all out, thanks tho :)
aight
Alright and then any ideas on where to start with when the bot leaves a guild it'll check if the owner is in a specific server
like a way to array the members of a specific guild?
var memberlist = server.members.array();
is that?
How would i actually use that though?
Cuz im basing in a specific server from a specific person
like if(server.members.has(guild.owner.id)) {
}
?
@slim heart why is there a server var and a guild var
the server im seeing the person is in is server
so im seeing if a person is in my support discord when the bot leaves their server
const guildowner = bot.users.get(guild.owner.id)
if(!guildowner) return;
const supportserver = bot.guilds.get("399688888739692552")
if(supportserver.members.has(guildowner.id)) {
//stuff
}
})```
would that be?
it works
okay and then how would i create a member object? ive never done this kinda thing so i got no clue
would it be let blah = supportserver.members.get(guildowner.id)
no its not
idk
const guildowner = bot.users.get(guild.owner.id)
if(!guildowner) return;
const supportserver = bot.guilds.get("399688888739692552")
if(supportserver.members.has(guildowner.id)) {
let guildownermember = supportserver.fetchMember(guildowner.id)
console.log(guildownermember)
let role = supportserver.roles.find("name", "Server Owner");
guildownermember.removeRole(role);
}
})```
what is wrong here...
it says removeRole isnt a function
is this python?
js
umm what happens if I do Collection.find() and it has nothing that has the certain filter?
itll probaly return null but I dont know the context. Why dont you test it out
that means that that whatever object type "guildmemberowner" is, it doesnt have the function "removeRole"
it returns a promise
I ditched discord.js a while ago and havent used it since. Look in the documentation and see what type fetchMember returns.
or fetchmember is returning null
from what I understand supportserver.fetchMember(guildowner.id).then(//Put code here) should work
async/await is neat
it is
so you'd make your function async and just change it to
let guildownermember = await supportserver.fetchMember(guildowner.id)
dunno
Client network socket disconnected before secure TLS connection was established
never got that error before
and this is in php?
js
do u have uws installed?
so
why are you taking message from a ready event
d.js
theres like 3 js libs for discord
discord.js
d.js
mk ill look at their docs
I know
you cant get anything from ready.
then why do it
ye but
just to occupy space
its still gonna error regardless
^
you can do () =>
^
o
to occupy space
const Discord = require('discord.js');
const client = new Discord.Client();
client.on('ready')=> {
console.log('Ready!');
});
client.login('token');```
I don't know much of discord.js

but i know with discord api
you cant get message from ready
for example in lua its lua client:on('ready', function() --blahblah end)
not too different.
I'll look at his error again.
yes
are you running on windows or linux
windows
I installed it
then answer us when we ask
ok
is this your first attempt / has d.js worked before?
....
d.js worked before
(node:6712) [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.
will terminate the Node.js process with a non-zero exit code. h m m m m m
still worth looking into
well you're being disconnected before handshake
running any firewall or any paranoid antivirus?
this is where i take my leave, #notmylib
can you client.on("disconnect", console.log)
ok
see if that brings something up
but you should also handle the promise so it doesn't crash the process
client.login("token").catch(console.error)
ok
i would add this for good measures
process.on('unhandledRejection', error => console.error(`unhandledRejection:\n${error.stack}`));
process.on('uncaughtException', (error) => {
console.error(`uncaughtException:\n${error.stack}`);
process.exit(); // better to exit here.
});
process.on('error', error => console.error(`Error:\n${error.stack}`));
process.on('warn', error => console.error(`Warning:\n${error.stack}`));
yea its good to handle everything, but its ok with his 10 lines file for now xD
lmao yeah
Is it possible to create like a message and then keep being able to edit it like forever, ik u can with ids and stuff but like would the message ever like "expire" and not be able to be edited anymore?
I don't think there's a limit for editing messages?
As long as you have the perms to edit it
could be considered api spam
plus why?
iirc there's a chance that if the message is far in channel's history then bot won't be even able to find it to edit it
there is a ratelimit
remember the times when I was editing messages fast with a selfbot on an old account
Oh in that case you can edit any message from any time
As long as the bot can get a message id to edit it's possible
I don't think Discord limits the time period of edits
I think the same
with d.js you'd probably just need to fetch the message by ID because after a point it won't be loaded into cache if the chat scrolls down to cache limit
Yeah fetch it always just to be sure
π€·πΌββοΈ
If you dont have an id but know some specific details the message should contain, attempt to fetchMessages() and then filter the collection to your requirements
ya
Like I want to have one message and then when the bot goes offline it edits it and when it comes back on it edits it again
Can anyone help me make my bot auto give new members a role. I am using discord.js
Thx
Np
How do is start my bot again?
What do you mean?
How do I bring him online
Are you using Node.js?
one small question, if you don't mind, how old are you?
15
alright, thanks
Y
lmfao
don't worry, it's nothing

we were seeing if your qualified for the under 13 channel
How do I make make my bot stay online with out my code thing open?
You can't
use a process manager
On a local setup
Can u help me @topaz fjord
By the way can you show your code
npm i -g pm2
pm2 start <your bot file>
in your console
Where is the client login
@earnest phoenix no token 4 u
Ya that is hidden away so people know see it
So you had it there at least?
Itβs there cuz my bot is online now
Because you need it
Since you're using the vscode terminal no need to open up another cmd
?
But how do I keep him online 247
buy a vps
What is a vps?
Or host your bot on a server
Virtual Private Server
How much?
check pinned messages
Depends
On
Most hosting companies offer different plans for different needs
If your bot is small then you don't need an expensive hosting plan
@earnest phoenix u
Can I get a working link to the Amizon one
@topaz fjord no u
Also not all free hosts are shit
heorku and glitch
Most are pretty bad tho
= shit for discord bots
Glitch is okay
Why not
afaik they're not made for it
You can use glitch for many different things
Heroku on the other hand
Is gaaaayy
Even so i use localhost for my bots so whatever lol
lmao
Well you can't host database servers on glitch
Not sure about heroku (free tier)
iirc Heroku offers databases to use
Does the free tier include mysql or mongo dbs
What is local host?
or bad mod
Localhost is a server thing that runs on your pc
Is there a way to keep my bot up with out my cv open?
localhost is your pc
no
I think
without buying a vps you cant host without your pc open
No I ment my code editor
you dont need your code editor open, if your running in the code editors console you do
vscode is great
Oh
@knotty steeple true
but trying to use it for running your bot with the debug feature is 
Lol debug a bot with vscode

I guess I need to install the python compiler
In order to debug JavaScript

wat
Lol is there anything else worth adding there
xDDD
oh ya you're right
Hey,
I recently moved to a new Ubuntu VPS and I still haven't found out what issue I have with snekfetch. Every command I use snekfetch in it returns undefined and fails to work. I have no idea why snekfetch decided to this now but the same code works on my Windows hosted bot
Thanks @elder rapids for the suggestion
I need some help with my bot. I'm using discord.py and I'm trying to make a command to edit the color of a role. I have: newvalue = discord.Color(value) which is the color typed in. for roles in ctx.message.server.roles: if roles.name.lower() in name.lower(): this searches the server roles to find a match. And: await bot.edit_role(server=ctx.message.server, role=roles, oolour=newvalue) this should edit the role but it doesn't change anything and returns no errors. Is there something I'm missing?
ok, I just saw the typo in the word color in the third code block and I fixed that, but now I get a bad request error
will a bot post a shard count to its page on discordbots.org if it only has one shard present?
you can choose whether you want to send shard count or not
@earnest phoenix
you dont necessarily need to
all it does is show how many shards you have on the paage
o ok
Can i have a little help... discord.js here
so if you do user.presence.game.name of course it shows the name ofthe game a user is playing but if user isn't playing any game it crashed
how do i check a condition that a user is or is not playing a game
technically to prevent the crash
else
user.presence.game.name || "nothing to see here"
thank you imma check that out
ok
Finally @lone nymph did a full proper boot without timeouts that only took like 30 reboots
can someone help me out too? with the edit roles in discord.py
amm @trim plinth it still crashes with
TypeError: Cannot read property 'name' of null```
hm
I don't know js but couldn't you do some type of try/catch or try/except?
nah
catching the error with try/catch doesn't help in this situation
@vestal cradle try ternary operators
ya.... i 've been trying to fixthe same thing for straight 10 minutes and it's bugging me so bad XD
I think that's how you spell it π
user.presence.game.name ? user.presence.game.name : "owo whats this"
guys join my game in league
OwO

No
still cannot read property 'name' of null OMG my brain is hurting XD
show your code
Coding is a pain
sometimes
it might be something else causing the error
wait 2 sec
am just gonna put in first state @trim plinth before i started asking here so you get rough idea of this
ok
there @trim plinth
it works perfectly fine if a uer is playing the game but if someone is playing nothing then it fudges up
and by "msg" is just "message.content.toLocaleLowerCase"
why locale lowercase
Just so nothing interupts with lower or upper case
like you can either type k!stats or K!sTatS and still work
theMessager.presence.game.name ? theMessager.presence.game.name : "not playing anything oof"
something like that
might work? ```js
.addField("Playing", theMessager.presence.game.name ? theMessager.presence.game.name : "Not playing anything");
@knotty steeple oof
theMessager.presence.game ? theMessager.presence.game.name : 'blah'
Guys I have this document in Mongo:
{doc: [{obj: value}]} and I need to know which query to use to check if a field with the name "obj" exists in "doc"
then 
@vestal cradle that last one wouldn't throw cannot read property 'name' of undefined
it does tho
yes use @uncut slate's stuff

js master
then you're probably not saving your code
save and restart
ahm ahm i did save it xD
show me how you used it
did you restart 
inb4 hasn't been saving this whole time
yes
Rip
@trim plinth your guys' snippet was wrong
yeah
yes
you would first check if the game at all existed, not just the name 

π
now that that's settled, is anyone able to help me? I've been stuck on this for a while

I need some help with my bot. I'm using discord.py and I'm trying to make a command to edit the color of a role. I have: newvalue = discord.Color(value) which is the color typed in. for roles in ctx.message.server.roles: if roles.name.lower() in name.lower(): this searches the server roles to find a match. And: await bot.edit_role(server=ctx.message.server, role=roles, color=newvalue) this should edit the role but it doesn't change anything and returns httpexception 400 . Is there something I'm missing?
this is what I posted earlier
@mental trellis i have a code which creates a new role ...
try{
role = await message.guild.createRole({
name: "Silenciado",
color: "#FF0000",
permissions: []
});
try changing this createRole code to modify ..
ve discord.js.org, there you can have ideas
my bot is in python. I'm not really sure how I would switch that from js
and I have a command that creates roles, which works. but it starts having problems when I add color
have any 1 setprefix code?
ooh, sorry ;-;
π
i do not know how it works in python
thanks anyway
see the discord python api documention... http://discordpy.readthedocs.io/en/latest/api.html
I did. the edit_role docs says to do bot.edit_role(server, role, fields) and that's what I have
await bot.edit_role(server=ctx.message.server, role=roles, color=newvalue)
talvez
bot.edit_role(server, role, fields)
bot.edit_role("name", "role name here", {
color: "#FF0000"
});
@uncut slate is there a way to get "member" or more exactly .then(member => { }); without banning or kicking?
for a snippet like that you want to try to avoid .then
just resolve the promise with await
if you're not fetching at all you can msg.channel.guild.member(id)
:/
but i mean like if you type "member.whatever" if you don't define a function member it says "member undifined"
at least that's been the pain of entire bot always when i had to declare member
0|main | Error: 403 This host is not accessible.
0|main | at _response.transport.request.then (/root/node_modules/snekfetch/src/index.js:182:21)
0|main | at <anonymous>
0|main | at process._tickDomainCallback (internal/process/next_tick.js:228:7)
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at Botinfo.run (/root/forbidden-bot/commands/Information/botinfo.js:144:30)
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:228:7)
I've spent about 9 hours trying to figure out why snekfetch won't work. I moved to a new Ubuntu Server and snekfetch decided to not work. The Error above came from discordbots.org. I've tried several different urls and they all return undefined. Strawpoll, and Fortnite TRN are other apis that all return undefined.
The same code works on my Windows hosted computer. I'm running on node 8.11.2 and Snekfetch version 5.6.0. Has anyone else had this sort of problem?
try using something like curl to see if it's snekfetch or your machine
I did, it's snekfetch
what about superagent/https/another node.js request library
superagent I guess, it doesn't really matter that much
superagent is the very very similar to snekfetch syntactically, you'll probably be able to just change require('snekfetch') to require('superagent')
Looking at it, the only thing I'd have to do is remove .then and .catch and replace it with .end
π
Yea, ok don't need to change anything. I'll be back soon to let you know if it works
@uncut slate Yep that worked thanks!
I probably will
but if you want to use SF badly (less dependencies but also more prone to borking as you've found out), you can try downgrading your snekfetch version

Can someone help with a way to collect and input each users ids into a database from servers that my bot is on?
Discord.js
eh
would anyone happen to know what the exact ratelimit value is for editing messages
i know but i was hoping to find a value or something, like 1/250ms for reactions or 5/5s for messages
yβknow
This?




