#development
1 messages Β· Page 664 of 1
How would you prevent this if / else if hell
if (x < 3) return a;
else if (x < 5) return b;
else if (x < 10) return c;
else if (x < 15) return d;
...```
that's a hard one tbh
Does anyone know how I can align text to the right side of a picture in HTML and CSS?
@abstract crow This might come in handy: https://www.w3schools.com/howto/howto_css_image_text.asp
I guess that's exactly what you're looking for
Well not in the picture but like outside of it
Oh
use a table?
I thought you didn't need to
@late hill ```js
things = [
{value: 3, ret: a},
{value: 5, ret: b},
{value: 10, ret: c},
{value: 15, ret: d},
];
...
for(const {value, ret} of things) {
if(x < value) {
return ret;
}
}```
theres probably a way without tables
Did you look into the float attribute?
I I Text goes here
you can also make massive switches if that's your thing
otherwise it's if-else or something like that
or a massive lookup table if you don't care about memory
If you have
img {
float: left;
}
p {
float: right;
}```
And use these attributes, the image will remain left, text will stick to the right side
I don't think so
How does it know then what to float against? Like how does it know not to float to the left of something else?
Because you tell it to float to the right? π
The margins and divs are all up to you
It'd make things a lot better obviously
How can I center it though?
Wait I did float left and right and then did some padding, is that correct?
Should be fine

You can use padding into any direction and could eventually use 50% to make sure it's always in the middle
padding-top on 50% should work
oh wat, the java home is still jre-9

Would anyone happen to know why float right does this?
Puts the facebook like icon to the top left of the navbar instead of the bottom
Ik this conversation ended a while ago
but about that if/else hell
that's why languages that are actually good have match statements and stuff for that
The only good JS solution I can think of are nested ternaries, but they get complicated quickly...
function foo(x) {
return x < 3 ? a : x < 5 ? b : x < 10 ? c : d;
}```
yeah but he wanted a "better" solution
i find if return way more readable
i assumed he meant "shorter", since that was already pretty readable
i think for simplicity's sake you should just use if/else over multiple ternary operators
since x ? y : z is not restricted to a simple equation but that's what makes it easier to read
also vinnie your like button is floating to the right because you probably put it inside the same div which is floating right
Yeah that was it lol. But now there is this invisible space between the image and the navbar. Using inspect element there was no margin/padding there so idk.
Can anyone make me a logo for free. If so dm me
One message removed from a suspended account.
One message removed from a suspended account.
you want a logo? Make one.
Idfk how asking for a logo has anything to do with bot development
@ripe gyro Keep it on topic please. #memes-and-media for off topic.
await ctx.add_reaction('π©')
```why this works on the on_message and no in commands (`AttributeError`)
resolved doing ctx.message.add......
vinnie
may i recommend uh trying to move the like button to the left by placing its element above your title, then floating it left
it's a really loose answer but it might work
Ik this is a long shot but does anyone happen to have written css to produce a result like this:
I want to make a page look like a discord message, but i want it to be as close enough to discord as possible
look around in the DOM? \o/
i've done that @opaque eagle
flex it
it has a gazillion different css selectors and properties, and there must be a simpler way @earnest phoenix
@sick cloud GitHub/CodePen/JSFiddle?
oh ok, that's fine
CSSDesk is a online HTML/CSS sandbox. Experiment with CSS, see the results live, and share your code with others
fonts are off but
it's "vague"
i could improve that a bit
you probably could
do you know what font discord uses
yeah
isnt whitney like a private one or smth
:v
anyways i have a question
i have a lot of images to show in the bot that people can browse through then buy
what's the best way to display them
Discord.js bots intensive on CPU or ram?
discord.js caches everything and uses a lot of memory
cpu usage depends on what you do
def cpu
try running a bot on an rpi you'll see it jumps from 1% to 50%
i mean you can do it on any computer
and see a spike
probably
idk
https://javascript.is-bad.com/8M8tA2k.png mine stays at around that
spikes when starting/etc are to be expected
what you should look at is the value after starting
thanks 
make sure if youre using d.js, that youre using the optional libs as they make it use significantly less cpu
you can optimize ram usage a lot too in d.js (clientoptions + clearing the cache for stuff you dont use)
thank youuuu
may i ask about discord.js?
let say i have 5 chance to answer question, but when i do loop with for it send 5 message at the same time.
how to send it one by one with loop after answer message is collected?
you have 3 options:
for loop with async/await
recursive function
setTimeouts with multiplicative values
async def kick(ctx, member: discord.Member, *, reason=None):
await member.kick(reason=reason)```
the kick cmd
lol u need more
yes you do
try that
conner if not using js then no help
lol
python not as good
^ i use python aswell. So i can help you @jolly nova
I mentioned the code above
what is the error?
so i dont kick the user?
Nope
hm so no error
remember that it needs to respect the hierarchy
the bot's highest role needs to be above the user's highest role in order to kick them
a bot also can't kick the server owner
Yup i know that too noone can kick owner
Any Ideas how i could make an Shop System?
by writing code
Cry jumping in with the 40000 IQ
they asked a question with no detail, i provided an answer with no detail 
Ah. I don't code in js so I can help you with the steps but nothing code-specific
You could start off by storing the shop items in a database of some sort. Make sure you give them an easy name as well, so you can search by both name and ID perhaps
Then you just want to make a command which displays all that (for loop) and depending on how you want them to be able to buy items, you can identify it by name or ID
@jolly nova Do you have an error handler in your code
What would be the best method of making a small giveaway "timer" that edits every once a while?
I'd just want a concept because my current one is very buggy
And it speeds up a little after it passes a specific time
Get the timestamp for when the giveaway should be ended, check once every minute or so if that time stamp has passed, if not return and check again in a minute. If it is then edit the message
What could I do to make the timer edit "faster" after a specific time
I wanna do something close to giveaway bots timer
how to list all members in an role? im using d.js
what have you tried
nothing yet
Anything but googling
hey uh
cant seem to access the things i want
i havent slept in like 24 to 26 hours
and arrays confuse me anyways... because theres so much going on
im trying to access avatarURL
data.metadata.avatarUrl is correct?
hey
Does anyone know how I can setup express.js so that I can gave my directories like this
main_folder(website)
server.js, pages, images, etc.
And then when I type in url.com/page it will go to the pages directory and find that page name?
you want to serve static files or you want to serve an express-controlled page/ejs/etc?
static files
I tried that already
And it doesn't seem to work
I tried ./
app.use(express.static('./'))
app.set('views', path.join(__dirname, './pages'));
app.set('view engine', 'ejs');
app.get('/', function (reg, res) {
})
use a folder
I don't want to though
That is why I am having the issues. I don't want to have github_repo_folder > public > files
express seems to shit itself with the root
Oooo ok
i wouldn't recommend using the root anyways
So then if I had public, then what would I do for the pages folder?
Right but what do I do for my code
If everything but the server.js is in the public folder, andI have a pages folder inside of the public folder
app.use(express.static('./')) app.set('views', path.join(__dirname, './pages'));
remove the . from the 2nd line
Ok so just /pages
the folder you want static files to be served from
Ooo ok. So public in my case
yeah
And the pages folder will work being inside of the public folder?
if (!args.slice(1).join(' ')) return message.channel.send('β please input a calculation.');
let resp;
try{
resp = math.evaluate(args.slice(1).join(' '));
} catch (e) {
console.log(args.slice(1).join(' ')) return message.channel.send('there was an ' + e);
}
const mathembed = new Discord.RichEmbed()
.setColor('#7289DA')
.setTitle('Math calculation')
.addField('input', `\`\`\`js\n${args.slice(1).join(' ')}\`\`\``)
.addField('Output', `\`\`\`js\n${resp}\`\`\``) message.channel.send(mathembed)
break;```
you'll need /public/pages though
Always send please enter calculation
Ok so for the views then do /public/pages?
yes
@pallid zinc args is undefined or your slicing it off, learn how js arrays work then look back at your code
@sick cloud I did that but when I do url.com/pages/about nothing happens
It always worked for me though
app.get'/pages/about', (req, res) => {
});
I never needed to do that
It always just worked
I also have app.get('public') if that does anything
4:38 PM
TypeError: msge.awaitReactions is not a function
4:38 PM
at Object.exports.run (./commands/helperino.js:66:6)
4:38 PM
at Client.bot.on (./index.js:199:31)
4:38 PM
at Client.emit (events.js:194:15)
4:38 PM
at MessageCreateHandler.handle (/rbd/pnpm-volume/e30f7175-fe1e-4630-912d-98d4c74e8aff/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
4:38 PM
at WebSocketPacketManager.handle (/rbd/pnpm-volume/e30f7175-fe1e-4630-912d-98d4c74e8aff/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:105:65)
4:38 PM
at WebSocketConnection.onPacket (/rbd/pnpm-volume/e30f7175-fe1e-4630-912d-98d4c74e8aff/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35)
4:38 PM
at WebSocketConnection.onMessage (/rbd/pnpm-volume/e30f7175-fe1e-4630-912d-98d4c74e8aff/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17)
4:38 PM
at WebSocket.onMessage (/rbd/pnpm-volume/e30f7175-fe1e-4630-912d-98d4c74e8aff/node_modules/.registry.npmjs.org/ws/6.2.1/node_modules/ws/lib/event-target.js:120:16)
4:38 PM
at WebSocket.emit (events.js:189:13)
4:38 PM```
^ how do i fix this
discordjs btw
script: https://pastebin.com/ErvQb8SV
have you tried reading the error
it says its not a function
so like this?
for (const r of reactions) {
const emoji = r;
const customEmote = bot.emojis.find(e => e.name === emoji);
if (!customEmote) await m.react(emoji);
else await m.react(customEmote.id);
}
}).awaitReaction(filter, {time: 15000})```
think about it and then ask me again
the only difference here is that you're not storing it in a variable
can you rephrase everything you just said, it makes no sense
Hmm, trying to solve a user input/object refactoring problem
objects = {
object1: {
aliases: ['o1', 'obj1'],
test: () => {
console.log('Object 1 found!');
}
},
object2: {
aliases: ['o2', 'obj2'],
test: () => {
console.log('Object 2 found!');
}
},
};
let userInput = "o1";
// input.test() is the goal if it exists.
I was looking at the "default" bot command handling
and thought I could mimic the concept with an object
I like the idea because it handles a variety of garbage inputs by simply not being apart of a collection/array
for(let key in objects) {
if(objects[key] === userInput || objects[key].aliases.includes(userInput) )
return objects[key].test();
}
the aliases part of that works fine, but the "object name" does not, sort of making the object name pointless
π€
given that this whole experiment is to make code look prettier (a structure of objects rather than a bunch of functions from a switch tree)
I'm not sure im satisfied with that
you want to compare the key, not the object
Integer json_2 = Integer.parseInt(json);
for (int i = 0; i < json_2;){
json_2 += 1;
String n__ = json_2.toString();
ImageView imageView = new ImageView(null);
imageView.setImageResource(R.drawable.ic_dashboard_black_24dp);
LinearLayout relativeLayout = (LinearLayout) findViewById(R.id.linearLayout);
relativeLayout.addView(imageView);
//ImageView imageView = findViewById(R.id.PostImage);
Picasso.get().load("http://neko-bot.net/posts/post" + n__ + ".png").into(imageView);
}```
Im still fairly new to java, all strings are defined, but why does it crash. do loops not work like that?
oh
it wasnt even that
i fucked way the hell up
it was not indenting the string definition in the discord code block
it all went down hill from there
π
I kid
I always laugh when people help me in here
and they ask "can I see what this function does?"
xd
then I reply "oh... shit.. nevermind"
its supposed to display a image
but.. the icons for the bottom navbar were a little fucked
yep
im dumb
back to my problem now that it doesnt crash
π
you're missing an i++
on the loop
it's an infinite loop so nothing will ever update since you lock the UI thread
yeah but i quite literally cant
its under a postexcecute
im sorry i dont understand that :I
oh
nevermind im dumb
as usual
whoooo now it frezes :D
Probably because you increment json_2 and i at the same rate
Itβll never leave the for loop
As long as json_2 is initially set > 0
@outer niche Windows Key + Shift + S
Okπ
Ok
@outer niche Why are you typing this in the shell?
to see what happens
I don't recommend shell first off
Use command prompt or something
put your code in a .py file
and then open cmd in its directory and type python 'name of file'.py
I don't know how to
so make a new folder anywhere in ur pc
All right I've got a new folder
here lemme just call and screenshare to u what i mean
Why doesnt this save the data?
async def setadminchannel(self, ctx, alog: discord.TextChannel=None):
if not ctx.author.guild_permissions.administrator:
await ctx.send('You dont have permission to use this command')
return
else:
with open("data/lockdown.json") as thefile:
logs = json.load(thefile)
documented =False
for x in logs:
if x == ctx.guild.id:
documented = True
if documented:
logs[ctx.guild.id].append(alog.id)
print(str(logs[ctx.guild.id]))
else:
logs[ctx.guild.id] = [alog.id]
if not alog:
await ctx.send(f"Admin channel removed")
else:
await ctx.send(f":warning: **Warning!** The data might be deleted at some point, because the bot is under development\nAdmin channel set {alog.mention}")
with open('data/lockdown.json', 'w') as f:
json.dump(adminlog, f, indent=4)```
Are you sure x == ctx.guild.id is ever True?
Idk
Also, do you really want to open a file on each command execution?
no

Do you know how to fix or not?
If you don't want to open a file on each command execution, why did you code it to do just that. Or are you not that one who coded it but used ctrl c and v.
i didnt code it, a friend did
Then ask your friend, they wrote the code and most likely know what's wrong.
Alright then, what do you mean with not saving data. Does it store until reboot, does it not store at all, is it stored wrong?
Why don't you actually check if your if statements are true

It doesnt store at all
a log
shut, I know what I am doing 
I sure hope so, on thing wrong and someone bad has access to your root and can do everything 
But Emil, what rxactky is adminlog? What type of object is it? Are you sure it, at the very least, exists?
It exists
Ysah dw Timo I ain't good no passwords on my VPS
async def on_ready(self):
global adminlog
try:
with open('data/adminlog.json') as f:
adminlog = json.load(f)
except:
adminlog = {}
def getjson():
with open('data/adminlog.json') as rfile:
data = json.load(rfile)
return data```
Like I got some important things there anyway 
I understood close to nothing about that
Is there anyway to use on_message and the commands.Bot extension
Wdym
And what about your bot token 
token?
on_message if defined anywhere means commands.Bot doesn't work
That message was for Oswald
True
I even updated to the the newest version and still nothing
Sigh
Anyway, this is all python stuff bye
Do you know bot.process_commands, Allexx?
no
Right
I'm new to all of it

bot.process_commands is a function that accepts a Message object as its only argument
and it's a coroutine
so instead of on_message use process_commands
Uhhh
no
I never said it was an event
It's just a function 
Okay
Big brain shiv
No coding language is easy
Okay but without the will to learn or simple knowledge of coding things it's not easy
I never said i was unwilling to learn
Either way, if you are sure you need on_message, use bot.process_commands in it
You can share some parts of your code ya know
Its ok
Btw, how do I have multiple or customizable prefixes with this setup
or is it just not possible?
Depends on how you set it up
if you give command_prefix argument in commands.Bot an iterable, it's multiple prefixes
@slender thistle
import discord
import random
from discord.ext import commands
import asyncio
import time
bot = commands.Bot(command_prefix = "s/")
@bot.command(pass_context=True)
async def msg_test(ctx, word):
print('running')
await ctx.send(word)
@bot.event
async def on_ready():
print('ready')
@bot.event
async def on_message(message):
if message.author.bot == True:
return
if message.content.lower() == '!test':
await message.channel.send('test')
await bot.process_commands(message)
Exluding my token on purpose
So far so good but pass_context is unnecessary
yeah, but i was told it's just standard
in older versions yes
to avoid confusion it's nice to always have it
well either way, is it possible to have multiple prefixes?
or is it restricted to just the one?
Give command_prefix an iterable
Literally any object you can iterate through iirc
Let's dive into docs while we are at it
is there a way of making it so multiple commands call the same function in a way that isn't long-winded?
I know how to in javascript, but more specifically python and using the commands.Bot extension
What would the func do
in the same way you'd call a function, say !test. but instead of !test you could also do !t and that function would hypothetically do the exact same thing as !test
There's aliases arg in command deco
probably any iterable as well but I usually slap a list in
Hi, um just a java question:
I've created a filter with a few words in a database. I want to check if the message the user sents, contains just one string in the database. How can I check that?
Java or JavaScript?
Nice
does eris have internal sharding so i dont have to manually deal with them?
Does anyone know how to play sound files in discord.py? Is there a specific type of file I need? And whatβs the command to run it in the latest version?
@halcyon nymph it's in the repo, but you have to do some modifications to the example to not get it to play from only YT
@cursive dagger whatβs the repo?
@cursive dagger thatβs for YouTube videos, i want to play audio from file
Do you know if itβs possible?
@halcyon nymph discord.FFmpegPCMAudio is the thing you want
what's a shard
Sharding is the process of breaking up something into multiple instances
As to ease the load from one instance
A shard for a discord bot will handle a certain amount of guilds, while other shards will handle seperate guilds
how can i poperly paginate through discord guilds
its always been a confusing thing with the before and after params like what am i meant to do
can i have some help
so i want to make a partner command
like this !partner (server name) (description) (link)
idk how to do that
which language/library?
well, define how you want to delimit the fields
either set a delimiter like [server name] [description] [link] and use content.split() for example
or split it into multiple messages and use channel.awaitMessages() (assuming you're using discord.js)
I am using discord.js
So I want to put it in a embed format
What would that look like?
I am new to this donβt know everything
first you need to get the data you need and split it into the appropriate fields
then to send it, you can use the richEmbed builder
A guide made by the community of discord.js for its users.
Thatβs my first embed
So how would I do it so addfield and set description
To be filled out by the user
@quartz kindle
use message
assuming that embed you made is being triggered by a user, his message will be available in message.content
you read message.content and extract information that the user wrote from there
Ok
it's amazing how useful a second console is for testing interactions
just running a node compiler on a blank js
i just run a clone of my bot in nw.js
your little test screenshots encouraged me
full access to the discord.js api through chrome's dev tools
pretty lightweight testing platform
but it gets the job done to save other peoples time for questions
well to test simple stuff like that i just use the browser xD
hit f12 and type away
I've been on a refactor spree lately
btw you can add @echo off at the beginning of that rn.cmd file
When I type message.content
seeing how many "neutral returns" I can get away with
so it doesn't write to the cmd window the commands it's running
It doesnβt come up with content
ah ty again
show what you did
filled out by user, where would the input come from?
you know you can just copy/paste the code, no need to send a picture of it...
and even then, you could take a print screen
module.exports = {
name: 'embed',
description: 'embed',
execute(message, args) {
const Discord = require('discord.js');
const embed = new Discord.RichEmbed()
.setTitle('User Information')
.addField('Player Name', message.author.username)
.addField('Embed Version', 'version 1.0.0')
.addField('Current Server', message.guild.name)
.addField('Partner info', message.content, true)
.setColor(0xF1C40F)
.setThumbnail(message.author.avatarURL);
message.channel.send(embed);
}
};
prior to setting the embed code you can define variables
then use them in the ${var} formation in embed
where do you want the users message to go?
can you show the command you do and the response by your bot ?
ok
for partner command
so you gotta define those variables from the message
either by making args an array or otherwise
module.exports = {
name: 'embed',
description: 'embed',
execute(message, args) {
const Discord = require('discord.js');
const embed = new Discord.RichEmbed()
message.channel.send(embed);
}
};
waht would i put there
and then you can just concatenate them in your embed text
after i defined the vars
just testing discord a bit hehe
lol
oo
anyhow, in js you can use ` ` to embed variables like i did
to avoid sloppy concatenation strings
ok
so if the users message.content is "args", chances are "args" is an array of strings?
i am new as hell to coding so can you full out the command then go through what you did?
i am learning and been through tones of sights
but i am new to embeds
haha the most useful thing you can do is get immediate output
test things in the smallest environment possible
hmm
for example, find out exactly what is in the variables you are passing
console.log(message)
console.log(args)
you'd be surprised how big a message object is
π
hu
so far i have this
module.exports = {
name: 'embed',
description: 'embed',
execute(message, args) {
const Discord = require('discord.js');
const embed = new Discord.RichEmbed()
.setTitle(args[0])
.setTitle(Your custom title: ${args[0]})
message.channel.send(embed);
}
};
ooooo
so if i do like
.setdesription(Your custom description: ${args[0]}
that means the user can set the des
`Your custom title: ${args[0]}`; === "Your custom title " + args[0];
does that make sense?
its just a concatenation shortcut
like !p discordbotlist description then link
A guide made by the community of discord.js for its users.
module.exports = {
name: 'embed',
description: 'embed',
execute(message, args) {
const Discord = require('discord.js');
const embed = new Discord.RichEmbed()
.setTitle(Your custom title: ${args[0]})
message.channel.send(embed);
}
};
like that
yeah that would put the first non-spaced string in title
you can have as many ".addField"s as you like
then i can type .setdescription(your custom description: ${args[1]}
but the Title, etc is only 1 per
yes
it's all how you want to chop up the "args" variable
.setDescription(`Your custom description: ${args[1]}`);
yup.
yeah, once you get a desirable result you'll want to re-read my link
it explains the rich embed in depth
the more you learn how it works the less stressful the smallest change is π
Also remember it's just a variable until you send it
module.exports = {
name: 'embed',
description: 'embed',
execute(message, args) {
const Discord = require('discord.js');
const embed = new Discord.RichEmbed()
.setTitle(Your custom title: ${args[0]})
.setDescription(Your custom description: ${args[1]})
.addField(Your custom link: ${args[2]})
message.channel.send(embed);
}
};
test it out π
if your new to programming js is a very forgiving language
make use of the console.log()
trial and error is very simple
if you are running bot through node/command prompt
adding " cmd /k " in the .cmd will keep the prompt open
so you can read why it crashed
The forgiveness part is really true
you can just use pause
5 characters vs 6 characters π
pause waits for enter key right?
I don't think I've looked up a dos command list in 10 years
speaking of forgiving, I'm still patting myself on the back for subtracting "false" from an integer
I have a variety of "Spells" that return true, false, or damage done
therefore,
if(!spell.cast()) catches all false returns
ideally you'd have a single type of return
and playerhp - spell.cast() doesn't throw an error π
yeah, I just was looking for a single statement to work
const spellReturn = await spell.cast(player,message,target);
if(!spellReturn) // spell.cast returns false (text error sent to discord)
return;
target.currentHP -= spellReturn;
hey.. i need help with something really quick
completely disregard the app[worker]
thats hosting stuffs
but im trying to access the kills
by doing
well to access this array, i do data.data.stats
data.data.stats.metadata[1].value
would that work?
everything being called metadata is confusing me
if your searching for something, you need to have some way to find it right?
@teo.command()
async def unban(ctx, user: discord.Member=None):
await user.unban(reason='No u')
```with this i can't unban because the member is not found, how can i replace that discord.Member?
how do you create a server invite in a server a bot is in using server id? discord.js
guild.createInvite iirc
k
var serverid = "0000000000"
var server = client.guilds.get(serverid).id;
server.channel.createInvite()
.then(invite => message.channel.send(invite.code))
.catch(console.error);
am i right?
channel would be undefined
That's depreciated
oh opps
It seems that you're getting the invite for the current server so can't you just do message.channel.createInvite?
yo
Or is it a specific server
specific server by id
Ah alright
could use guild.channels.first() to get the first channel in the channel collection
So it would be const channel = client.guilds.get('id').channels.first()
and then channel.createInvite()
var serverid = "0000000000"
var server = client.guilds.get(serverid).id;
var channel = client.guilds.get(serverid).channels.first()
server.channel.createInvite()
.then(invite => message.channel.send(invite.code))
.catch(console.error);
^ so this? ^
channel would still be undefined
why?
you don;t need your server variable anywhere
Because if you use channel in that sense, it trys to get a channel from the guild object which doesn;t exist
im kinda confused. what's the difference between "var variable = stuff" and just "variable = stuff"
nothing?
var serverid = "0000000000"
var channel = client.guilds.get(serverid).channels.first()
channel.createInvite()
.then(invite => message.channel.send(invite.code))
.catch(console.error);
Well in that sense, var vaiable = stuff would be defining a variable and setting its value to stuff but variable = stuff would be nothing because you did not define it unless it was previously defined via let or var
gonna test
yah i saw and i realized ".get"
Help mi
(yes i prob messed up my bot a lot)
Δ°am From Turkey
var serverid = "xxxxxxxxxxxxxxx"
var channel = client.guilds.get(serverid).channels.first()
channel.createInvite()
.then(invite => message.channel.send(invite.code))
.catch(console.error);
{ DiscordAPIError: Unknown Channel
at item.request.gen.end (/rbd/pnpm-volume/6f09de16-9aa5-49a2-a56c-e6ed935704bf/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:85:15)
at then (/rbd/pnpm-volume/6f09de16-9aa5-49a2-a56c-e6ed935704bf/node_modules/snekfetch/src/index.js:215:21)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
name: 'DiscordAPIError',
message: 'Unknown Channel',
path: '/api/v7/channels/xxxxxxxx/invites',
code: 10003,
method: 'POST' }
epic
client.guilds.get("yes i did set this").channels.first().createInvite()
.then(invite => message.channel.send(invite.code))
.catch(console.error);
same error
nvm
found something
@shy turret you don't find channel by server id lmao
Im thinking of making a web dashboard for my discord bot, does anyone have any good resources? I was thinking of using express, vue, or react, but I don't know where to start. Can anybody point me in the right direction?
Mainly backend stuff
Hi how i can reset with quick.db all of my : db.get(`Mvote_${message.author.id}.vote`)
@slender thistle yup
module.exports = {
name: 'p',
description: 'p',
execute(message, args) {
const Discord = require('discord.js');
const p = new Discord.RichEmbed()
.setTitle(Your custom title: ${args[0]})
.addField(Your custom description: ${args[1]})
.addField(Your custom link: ${args[2]})
message.channel.send(p);
}
};
so i have that but when i type !p dadas then a space then type something it doesnt work
it only types one work
how could i fix that
i'm considering using lavalink for djs, is it worth it?
what im noticing is that lavalink seems to have some positives and negatives but i don't undestand them clearly yet
W-
how can i make is so the user that is typing the description can use more than one word
Join the rest of the args
resource usage should be way lower with lavalink/andesite (shameless self ad
) than with ffmpeg subprocesses
afaik a ton of great music bots use a lavalink fork
and you can offload music to other servers instead of having it on a single server
so make the args that same
the whole reason lavalink exists is to do that
like args[2] then args[2]
also, are there any downsides vs just using the stream dispatcher
like
Splice the triggering args/args u donβt want then do .join
Β―_(γ)_/Β―
(Your custom link: ${args[2]}) then (Your custom description: ${args[2]})
lol probably just extra configuration
i've always used lavaplayer directly
ah fuck isnt it for java
i am new to java
oh yeah thats why i said i was dumb
it's 11:20 at night rn
well thanks for uh giving me the benefit list

module.exports = {
name: 'p',
description: 'p',
execute(message, args) {
const Discord = require('discord.js');
const p = new Discord.RichEmbed()
.setColor(0xec0d0d)
.setTitle(Your custom title: ${args[0]})
.setDescription(Your custom description: ${args[2]})
.addField(Your custom link: ${args[2]})
message.channel.send(p);
}
};
how can i get .setDescription(Your custom description: ${args[2]})
to let the user send more than 1 message
like a full description not just like 1 work
word
If you donβt know what that means you need to go off and figure it out yourself
You need to learn
ok so basically
Well that's a template literal that's missing 2 things
ok so help on lavalink
am i supposed to create the playermanager for each client (assuming they are sharded) or in the master process
Hey, i am getting an error on VPS:
Fontconfig error: Cannot load default config file
When trying to use Canvas
@valid frigate if d.js lavalink, one shard = one player manager
if I remember correctly
cause I used that a while back ago
d.js
Promise.all(client.guilds.map(g => g.leave())).catch(console.error)
A bit of workarounds for the Discord.Py async version. - LazyNeko1/D.py-Workarounds
i believe this will work
but ima set it here.
It's all the things i do to get things that are in d.py rewrite into async.
isDm
anyone know how to add polls on discordjs
Is it really that hard to check if message.server is None
?????
How do you get an error on that? 
https://discordpy.readthedocs.io/en/v0.16.12/api.html#discord.Message.server
Optional[Server] -- always there but can be None
dont judge my methods
if they work they work
the nitro thing works fine pls gimme a break ;-;
nitro anything doesnt exist in async
imagine not having Channel#type and TextChannel#nsfw
if message.server is None
vs
if message.channel.type is discord.ChannelType.text 
MongoDB Command raised an exception: TypeError: 'Collection' object is not iterable
The collection should be 100% right
Some code would help
for x in mydb['Channels']:
if x['Id'] == channel.id:
return True
return False
What do you think mydb['Channels'] is
yes i know it is
But you don't iterate through a collection 
You iterate through documents in a collection 
I dont even know what iterate means, english isnt my first language
I found out what it means
Iteration is the repetition of a process in order to generate a (possibly unbounded) sequence of outcomes. 
So basically, it looks like collection.find is what you need
hi, how to find a category d.js ?
i do this :
let category = message.guild.category.find(u => u.name.startsWith("β Stats du serveur"))
uh
ok
thx u
@sick cloud i can use that :
let variable_categorie = message.guild.channels.filter((channel) => channel.type === "category").find((cate) => cate.name === "β Stats du serveur");
why did you mention me for that
it's a question sry
you can, but if someone renames it only slightly ur kinda fucked
yeah
let me introduce to you: "const"
@teo.command()
async def unban(ctx, *, member: discord.Member=None):
bans = await ctx.guild.bans()
for ban_entry in bans:
user = ban_entry.user
await ctx.guild.unban(user)
emb = discord.Embed(title='Unbanned!', description=f'{member.mention} has been unbanned!', colour = 0xfffb00)
await ctx.send(embed=emb)
```it does not find the member, how can i fix?
it's never defined?
you're using user everywhere
and then suddenly member.mention
how is it supposed to know what member is
user.mention?
probably
bans = await ctx.guild.bans()
for ban_entry in bans:
You mean unban everyone basically
(node:160) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
How to fix it ^^
when is glitch.com online again?
@tight heath that's rewrite docs tho?
@pallid zinc give the bot the missing permissions or handle it
@west spoke I've never used d.py in my life so
@pallid zinc check if you have permission before doing something
i.e. ban
or sending message
etc.
^
mine doesnt but but all admin actions require you to be in a "moderator list" for that server
But the bot still needs perms to ban
@pallid zinc ur bot doesn't have permissions to do the command you want it to do
DBL oy takip sistemiyle ilgilenen olur mu? Γzelden yazabilirsiniz.
They are allowed to use native languages here
xd
the rules say to speak english 
the error is on dbl's side, you can't do anything about it
Hello First Sorry For My English , My Bot Have A Giveaway Command Does Work Δ°m Using Uptime Robot For Bot Be 7 / 24 But Uptime Robot Sometimes Restart My Bot So Dont Finish The Giveaway What Can i Do Help Me Pls Maybe Δ°ts Can With .json But Δ° Cant π¦ Help Me
await message.channel.send(`Type the title:`);
const title = await message.channel.awaitMessages(res => res.author.id === message.author.id, {
max: 1,
time: 300000
});
const embed = {
"title": `${title.content}`,
}
message.channel.send(
{ embed });
return the title [objectMap]
can anyone help me to get the message content
Hello First Sorry For My English , My Bot Have A Giveaway Command Does Work Δ°m Using Uptime Robot For Bot Be 7 / 24 But Uptime Robot Sometimes Restart My Bot So Dont Finish The Giveaway What Can i Do Help Me Pls Maybe Δ°ts Can With .json But Δ° Cant π¦ Help Me
you wrote that already
It will restart sometimes.
@gray epoch title is actually a collection of messages
You can store users in a json sometimes.
actually
OKAY BUT Δ° DONT KNOW
json is prone to failure
@tight heath thank you bro it works β€
yw
It is, eventually.
I make most of my json owner-only and edit it manually most of the time.
@west spoke you do that until the file corrupts and your db dies 
first hand experience
package.json
also it's slow af
meh true
What about other module
to publish a module to npm you need a package.json
what I mean by backups are ones literally on mh website
it's a json file
imagine not having a seperate api path
oh I do
It's a bad idea
/info/ is for api
ok
how do I get an image from your api
as in what request
GET http://neko-bot.net/nekos/neko{ID}.png
gotcha
and GET http://neko-bot.net/posts/post{ID}.png
get http://neko-bot.net/info/totalnekos.txt or totalposts.txt
for the most for a random image
also neko2 and neko3 are the same
ik
ye I got the total counts
oof
oof
Also, what lang do you use? If I could upload it to a sort of pypi or whatever for other langs that would be g r e a t
ima start on a js and java one next
I use node.js
I can write a wrapper for that
Β―_(γ)_/Β―
and publish it to npm
if you wanna see the last wrapper I wrote, https://git.aero.bot/forks/ksoft.js
const mySchema = mongoose.Schema( {
property: String,
property2: String,
inventory: {
item1: { type: Number, default: 0 },
item2: { type: Number, default: 0 },
item3: { type: Number, default: 0 }
}
} );
quick syntax question for mongoose
that would appropriately define a nested object correct?
mySchemaName.inventory.item1 ?
been running into some network bottlenecks (discord.py) when attempting to use minikube to run the bot locally (both with kvm and on host os). anyone run into this as well? it appears that message events are not dispatched in a timely matter, but the function calls run properly
had similar problems when using just a vm but assumed it was due to disk issues (old 5400rpm hdd, performance was poor generally); current machine is on a fast ssd and still running into the same problems -- another assumption was network issues but it appears to run fine outside of the container environment on the host os
@maiden mauve thank you for the update
π
One message removed from a suspended account.
do u get the bot dev role when ur bot gets accepted
lol
or do i apply
like what do i do
in your bot edit page
you get it automatically when your bot is approved
ohok
One message removed from a suspended account.
I swear you've posted this before..
If gold doesn't exist you're creating newGold but continue to work with gold (which still won't exist), that's your error
Other than that
Just as I remember saying previously
You're mixing userId and userID
I also question if you have a reason for the gold to have it's own model
To me, it seems like it would fit very well on your Account model, but maybe you have a reason for not doing this π€·
(There's also the inconsistent usage of ; and a random global variable grrr)

fixed

