#development
1 messages · Page 1167 of 1
@delicate shore I have 100 lines in my index, But a total of 13k lines in my whole bot.
@pallid igloo i have 7k in total 2k in index
what is that ?
i also use command handler
Event handler?
no
what is that ?
@visual lake Api password for your bot.
no
@delicate shore Acceptable. Not everybody listens to all the events.
so whatever password you put there, you also put in the code
@pallid igloo thats where you wrong kiddo
thanks
XDF;'
Are we flexing the amount of lines we have 
Not everyone listens to all the events. Only some people (Like me) do.
Hell yeah we are
OH WTF
wew
while i may not use all events, i have them declared
i dont have to restart my bot whenever i make changes to listen to new events
¯_(ツ)_/¯
Beautiful
99,99% JavaScript, 00,01% JSON
99.9% C# 00.1% HTML?
I only have javascript and one config.json file
Guess that doesn't show much other than I'm using pipelines lol
I use azure boards :^)
i keep a readme backup for the open repo
the public repo readme is the same as the private one
¯_(ツ)_/¯
(╯°□°)╯︵ ┻━┻
┬─┬ ノ( ゜-゜ノ)
Friends, help me, I need you online.
Can someone help?
Error: Failed to lookup view "/home/kayuimineko/Cecyl/dashboard/templates/index.ejs" in views directory "/home/kayuimineko/Cecyl/views"
at Function.render (/home/kayuimineko/Cecyl/node_modules/express/lib/application.js:580:17)
at ServerResponse.render (/home/kayuimineko/Cecyl/node_modules/express/lib/response.js:1012:7)
at renderTemplate (/home/kayuimineko/Cecyl/src/dashboard/dashboard.js:85:9)
at /home/kayuimineko/Cecyl/src/dashboard/dashboard.js:141:5
at Layer.handle [as handle_request] (/home/kayuimineko/Cecyl/node_modules/express/lib/router/layer.js:95:5)
at next (/home/kayuimineko/Cecyl/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/home/kayuimineko/Cecyl/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/home/kayuimineko/Cecyl/node_modules/express/lib/router/layer.js:95:5)
at /home/kayuimineko/Cecyl/node_modules/express/lib/router/index.js:281:22
at Function.process_params (/home/kayuimineko/Cecyl/node_modules/express/lib/router/index.js:335:12)
at next (/home/kayuimineko/Cecyl/node_modules/express/lib/router/index.js:275:10)
at urlencodedParser (/home/kayuimineko/Cecyl/node_modules/body-parser/lib/types/urlencoded.js:91:7)
at Layer.handle [as handle_request] (/home/kayuimineko/Cecyl/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/home/kayuimineko/Cecyl/node_modules/express/lib/router/index.js:317:13)
at /home/kayuimineko/Cecyl/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/home/kayuimineko/Cecyl/node_modules/express/lib/router/index.js:335:12)
@earnest phoenix
There are 3 easy steps to getting help!
- Post your code
- Post your errors
- Send a short description of what you are trying to make
NEVER ask “will anybody help me?” or “Hello is anybody willing to help me out” as it wastes and makes helping you out slower, simply post your issue and a helper will get to you as soon as possible.
This is a serious issue and you need to work on this
Visit https://dontasktoask.com/ for more info about this issue.
I hope you understand !
Regards ,
A well wisher
he literally dropped his errror ?
He did.
@delicate shore Place gevt me hosting projekt !!
i am talking about @earnest phoenix
oh mb
@delicate shore Place gevt me hosting projekt !!
@earnest phoenix whaawaaaa

Yahh help me place
@earnest phoenix how can I help you with no information?
...
Against popular belief "does not work" is not sufficient information to provide to receive help.
What's the expected (wanted) behaviour, what's the actual (unwanted) behaviour? Do you get any errors? What's your relevant code that might be causing the issue?
wha-
No.
@faint prism Place send me website hosting projekt online bot ?
no
i have a script saying node index.js
You can use the terminal or shell
in package.json
i have a script saying node index.js
@delicate shore To run js outside of a webbrowser you need nodejs
@delicate shore bat files are old hat, these days we use batman files to start bots.
or vampire files.
😂
@faint prism Place send me website hosting projekt online bot ?
@earnest phoenix I'm not sure what you mean. In this channel we program our own bots
@delicate shore bat files are old hat, these days we use batman files to start bots.
@green kestrel or .cmd files :^)
you dont need nodejs to run js files outside of webservers
I am not getting it
u can use other runtimes like deno mmLol
Well, there you go. NodeJS, a webbrowser, or "deno" is execute JS code
@faint prism wat your name apps ?
Imagine using chrome to host your bot process lol
i don't
wha
nodejs and deno are the same things, runtimes
discord.js makes that possible, auger
its rly gay
runtime environments, if we're going into precise definitions
d.js-webpack is a thing so :^)
||I don't use JS. But I'm trying to keep up with you JS devs||
yeah, discord.js is stupid
@faint prism wat your name apps ?
@earnest phoenix "sppa eman" is my name apps. Idk what you mean by that tbh
||The joke: the quotes contain reversed text||
Send me wibsite online bot place @faint prism
@earnest phoenix https://github.com/search?q=discord+bot
Unless you mean https://top.gg/
Spice up your Discord experience with our diverse range of Discord bots
Any VPS provider will help you to get your bot running 24/7
¯_(ツ)_/¯
who?
¯_(ツ)_/¯
don't know
Never worked for a vps host, but from what ive seen, they get a lot of generic setup help requests.
The thing I've seen a lot is users blaming the VPS for user mistakes.
That needs cc
cc?
Im student i dont have credit card
oh
I got free azure in student pack
Why do students not have credit cards 🤔
I got free azure in student pack
@small zenith which pack is that
Github education pack @delicate shore
which student pack and where?
student pack
glitch v11 mute ?
?
huh
Why do students not have credit cards 🤔
@solemn latch we dont do jobs we cant pay for it
glitch has versions?
discord.js maybe?
he's asking for code i assume
glitch v11 mute ?
@earnest phoenix 1. don't use glitch
- upgrade to v12
- we don't spoonfeed
rekt
Azure vps's start at 1gb of ram with their burst lineup i think @small zenith
jk
Hmm Ok thanks
I need a mute code for v11.
did you just-
We will not straight up give you any code
not the r danny
Please change my name
no.
change your username
No
ok
When you make it easily mentionable without unicode characters, sure
Please change my name@pale vessel
what
yes
I mean. You can divide it by whatever you want
convert that to months
^ this, lol
price*24*7 would be weekly price
You can multiply it to convert. But ultimately it's $/whatever you want
🧠
Is what I was saying
@earnest phoenix here
I mean
ask stupid questions get stupid answers
thank you cry i loved that
yes
This isn't the place for that

Hourly is pretty common @delicate shore
A lot of uses people will spin up temporary a new vps for a few days or a week for testing or dealing with extra load.
@earnest phoenix might be easier to post in #memes-and-media but mention them next time
||But then I won't see the meme ;(||
I use DO as my test platform for the hourly billing
I got a question for other devs on here,
Does anyone else write programs to solve repetitive tasks. Like for class work for example?
I've done it for real life stuff a few times.
I use DO as my test platform for the hourly billing
@solemn latch what really?
Numerical methods and calculus? All the time
Yeah
nice
Numerical methods and calculus? All the time
@slender thistle YES. I made a script for synthetic division for a polynomial last semester lol (and shows work of course)
kek
We mostly deal with differentiation and integration in calculus. sympy generally helps way too much with it
We mostly deal with differentiation and integration in calculus. sympy generally helps way too much with it
@slender thistle my last example was probably making a Windows form app that did statistical analysis on a bunch of data points in a text file
It was the first time I had ever used a async :3
"form app"
Oh right you're C# gang
Yeye, dotnet for lyfe
But I did it in python too
And bash at first. Which was a terrible language to do it in.

It has no advanced math functions. I had to pipe to BC every time, which added A FUCKLOAD of latency to calculations
Geez
where python could calculate stats for 100m random datapoints in an instant. Bash ran overnight and didn't finish
C# is way faster than python. For maths I would use c# anyday
It was when I was first getting into programming
I moved to C# because i wanted a UI
Learned 3 languages over the course of that project lol (not well, but some)
Just use pygame 4head
-faq 1
Didn't know about it back then
C# is way faster than python
Well, it'd be kinda obvious, since Python is interpreted, whereas C# is compiled
PyQt gang
i have a question
for some reason when im coding my bot
Yeah but the margin which c# is faster is really astonishing
im trying to code a mute command in
@client.command()
async def mute(ctx, member: discord.Member, *, reason=None):
text_channel_list = []
for server in Client.servers:
for channel in server.channels:
if channel.type == 'Text':
perms = channel.overwrites_for(member)
perms.send_messages = False
perms.add_reactions= False
await channel.set_permissions(member, overwrite=perms, reason=reason)
await ctx.send(f"{member} has been muted by {ctx.message.author} because "+ reason )
@slender thistle
i get an error saying for server in Client.servers: ^ SyntaxError: invalid character in identifier
do you guys know why
doorthief moment
@slender thistle do u have any clue?
aye, use .guilds everywhere
but the error seems unrelated
yeah
are you trying to mute someone in all servers? lmao
here i'll just quote the code here
oh right
@client.command()
async def mute(ctx, member: discord.Member, *, reason=None):
text_channel_list = []
for server in Client.servers:
for channel in server.channels:
if channel.type == 'Text':
perms = channel.overwrites_for(member)
perms.send_messages = False
perms.add_reactions= False
await channel.set_permissions(member, overwrite=perms, reason=reason)
await ctx.send(f"{member} has been muted by {ctx.message.author} because "+ reason )
@modest smelt just so people can see
@pale vessel I know, that is why I'm confused
thanks for noticing that Tim lmao
How many days does a site approval take?
im trying to mute people in the servers the bot is in
why
yeah
doorthief moment
@pale vessel What do you mean by "doorthief" moment?
so basically, if someone gets muted, you want them to be muted in all servers the bot is in?
I sent a request for the site
but like
in any case, it's client.guilds, not Client.servers
@pale vessel What do you mean by "doorthief" moment?
@faint prism nothing, your github username was also doorthief
yea, but look. Just because someone is muted in one server for a reason doesnt mean they should be muted everywehere
if someone is muted in a server, why should they get muted in other servers that have nothing to do with it?
oh ok
@client.command()
async def mute(ctx, member: discord.Member, *, reason=None):
text_channel_list = []
for server in client.guilds:
for channel in server.channels:
if channel.type == 'Text':
perms = channel.overwrites_for(member)
perms.send_messages = False
perms.add_reactions= False
await channel.set_permissions(member, overwrite=perms, reason=reason)
await ctx.send(f"{member} has been muted by {ctx.message.author} because "+ reason )
@slender thistle is this correct?
@faint prism could've just used PyQt smh /s/s/s
Try it and see
channel.type isn't a string iirc
if someone is muted in a server, why should they get muted in other servers that have nothing to do with it?
@quartz kindle ok i think it is better to mute them in only like my server
so i should do ```python
type(channel.type) == "text":
@faint prism nothing, your github username was also doorthief
@pale vessel Ooooooh you mean the old python version
Nice find. That's waaaaayyyy old
If isinstance(channel, discord.TextChannel):
one sec I'm going through the docs
@client.command()
async def mute(ctx, member: discord.Member, *, reason=None):
text_channel_list = []
for server in client.guilds:
for channel in server.channels:
if isinstance(channel, discord.TextChannel):
perms = channel.overwrites_for(member)
perms.send_messages = False
perms.add_reactions= False
await channel.set_permissions(member, overwrite=perms, reason=reason)
await ctx.send(f"{member} has been muted by {ctx.message.author} because "+ reason )
just the code
yeah Rovi's way is correct
also you should check your bot has permission to do any of that before trying to change the users permissions
Python and bash comparison lmao
where's the new one?
the bot will be admin @delicate zephyr
not in all servers
not in all servers
Users can still remove the bot's permissions
i ask them for that perm
and they can remove it
so how should i mandate that?
I mean, you could always just not make it mute them in every server
where's the new one?
@pale vessel wdym? The C# one?
Yup. There's the option of not being an asshole, as harsh as it sounds. Just mute the user in the server where the command was used instead.
@faint prism mhm
admin perms for a bot introduces a vulnerability in people's servers
so many will reject your bot because of that
Since I gtg, my partner @earnest phoenix will be here
Hi I am working with @modest smelt
lol?
And requiring admin permission for your bot is the complete opposite of "mass appeal"
@quartz kindle then there are people who give all bots admin perms 
permissions_for(member)¶
permissions_for is a method of a TextChannel object
Are you using decorators?
and member must be replaced with anything that happens to be a Member object.
In order to get your bot's Member version in guild, you'd use guild.me
No, rovi, decos are unrelated to this
@bot.bot_has_permission(perm=True)
k
Ah ok
did you see their code at least
oh k
throw er; // Unhandled 'error' event
^
TypeError: Cannot read property 'current' of undefined```
Error
```js
weather.find({ search: args.join(" "), degreeType: "C" }, function(
error,
result
) {
if (error) return msg.channel.send(error);
if (!args[1]) return msg.channel.send("Please specify a location");
if (result === undefined || result.length === 0)
return msg.channel.send("**Invalid** location");
let current = result[1].current;
let location = result[1].location;
const weatherinfo = new Discord.MessageEmbed()
.setDescription(`**${current.skytext}**`)
.setAuthor(`Weather forecast for ${current.observationpoint}`)
.setThumbnail(current.imageUrl)
.setColor(0x111111)
.addField("Timezone", `UTC${location.timezone}`, true)
.addField("Degree Type", "Celsius", true)
.addField("Temperature", `${current.temperature}°`, true)
.addField("Wind", current.winddisplay, true)
.addField("Feels like", `${current.feelslike}°`, true)
.addField("Humidity", `${current.humidity}%`, true);
msg.channel.send(weatherinfo);```
Code
Just so it's clean i changed few things
and posted again
i think that is a pretty obvious error
result[1] is undefined
u sure u didn't mean result[0]?
Can anyone help me code a mute command for my bot?
Which part are you confused on, apart from the ones we helped with
u sure u didn't mean
result[0]?
@knotty steeple damn sure
@knotty steeple i even did that
did not work
debug
cmon man don't ping me twice
can we debug in glitch
you could debug on a piece of paper
im pretty sure you can debug on glitch
I dont know tho since ive never used it, they should have some debug tools tho
You have access to the console on Glitch
Fr?
You have access to the console on Glitch
@slender thistle yes
debugger keeps loading
never comes
#memes-and-media for other languages
You're not wrong
try catch
imagine not just letting it error but console.loging right before it does
Code: ```python
@client.command()
async def mute(ctx, member: discord.Member, *, reason=None):
text_channel_list = []
for server in client.servers:
for channel in server.channels:
if channel.type == 'Text':
perms = channel.overwrites_for(member)
perms.send_messages = False
perms.add_reactions= False
await channel.set_permissions(member, overwrite=perms, reason=reason)
await ctx.send(f"{member} has been muted by {ctx.message.author} because "+ reason )
Error Message:
```for server in client.servers:
^
SyntaxError: invalid character in identifier```
need help?
i want to make a dashboard for my bot
How can we help?
There's the option of connecting the backend to your bot's program
Have a look into some of the following:
EJS
React
and i would recommend looking into how to build an API
You likely wanna get a domain and some html knownledge going
so the website and the bot can communicate
i got a domain
then do waht luke said
you'll need a bit of basics of frontend development
free one is ok for testing purposes
No problem
i will buy a domain when i get it working
but for now im just using that 000webhosting stuff
So yeah you want some js on the website and a backend. The frontend will send a request to update data (to the backend) on a button click or something and then the backend will actually edit the database
alright
sounds logic to me
i hope it will work because my bot is fully coded in python
yep it will with flask or smth
My bot is in python and I have a working dashboard so it should be fine
shouldnt matter too much which lang you using
aha
most of the stuff will be html and the payloads likely in json format
Yeah make sure to abuse JSON 
lol
bInaRY
May want to consider making an API for communicating data between your bot service and the website frontend
Because with JSON you can send data and then have the client do work with making it into things and that reduces the load on your server
yep it will with flask or smth
@restive furnace I don't like to suggest Flask for Discord bots dashboards
since it's sync
I use aiohttp for my dashboard
alright i gtg now i have a bbq with my family but thanks for your help
Is that fine?
There's Sanic and aiohttp
@elder loom ok have fun
thanks
aiohttp is fine tbh
@restive furnace I don't like to suggest Flask for Discord bots dashboards
i used it tho, thats why i recommended it, but yeah idk whats best one
Never seen it fuck itself or a bot up. I use aiohttp.web in dblpy and it works
My code for my bot and my webserver are seperate, should I combine them?
There's no best one per se, you just want it to be asynchronous
So I have 2 clients open at the moment basically
You could combine them, sure. Make sure you keep everything secure though
Ok I'll look into it. In fact it would save me pain by combining them I think
In terms of files and what not
There's nothing wrong with running them separately if you don't need the website to communicate with your bot though
combining: shared variable access + easier to maintain code/files
not combining: need to maintain api and start seperately
Another option is to host a local API on the backend and send requests to it from the website backend 
Trying to make a bot that switches roles for users depending on which voice channel they join.
Theoretically the member will join voice channel x and will be given x role, although I have no idea how to start to make it. Any props ?
then you’ll have to prevent anyone from sending requests if it’s not you
i think idk im not a good dev kek
@valid holly listen to voice state event to know when user joins voice channel, get the name of the current voice channel the user is in and assign the role for the user. If you need to remove the role after leaving the channel, check the event to see if its a leave and remove any roles thats related to voice channel names.
Problem is not the lib itself, I'm comfortable with it, It's just finding a flexible way to manage this feature I'm implementing.
I was thinking to build a data structure consisting of channel ID's and role ID's then switching between.
X member joins Y channel, but already has x role, so switch from x to y
@valid holly what db do you use?
I don't think there is a need for db in this case, we're dealing with predefined data
Ah ok
Which I can easily define in code
then if you define it like
{
"voiceId": "roleId"
}
you should be able to then fetch/get the role and give to to the user that way
Yeah but it's more difficult.
The bot needs to check if you already have a role, then remove the old one and replace with the new one.
not really
Well that's what intending to do
Not just simply add and remove roles based on the join event
The bot needs to check if you already have a role, then remove the old one and replace with the new one.
I don't see any issues with that
you can then do Object.values(obj) to get all the roles you have available. and then check if they have any of them and if they have any other than the role assigned to the voice channel you can remove them
It's a feature I'm working in my server, which lets you switch between Discord "Servers" on a voice channel, and the roles just have access to different channel where you see different stuff
Such as "Social" role and "Gaming" role.
Yea
When someone switches a voice channel
Object.values(obj) will give you an array of ids
iterate through them and make sure the only voiceChannel Role they have is the one associated with said channel
if its not associated, remove it
I'll make some psuedo code
if you're willing to wait
what lang are you using?
Yea, Javascript
Can anyone help me code a mute command in discord.py?
ok gimme a minute and I'll have some psuedo code with comments
Didn't I explain like twice already
rule 7a
I didnt get it
tell us what problems are you having instead
Code: ```python
@client.command()
async def mute(ctx, member: discord.Member, *, reason=None):
text_channel_list = []
for server in client.servers:
for channel in server.channels:
if channel.type == 'Text':
perms = channel.overwrites_for(member)
perms.send_messages = False
perms.add_reactions= False
await channel.set_permissions(member, overwrite=perms, reason=reason)
await ctx.send(f"{member} has been muted by {ctx.message.author} because "+ reason )Error Message: ```for server in client.servers: ^ SyntaxError: invalid character in identifier```
@earnest phoenix
@fluid basin you realise giving examples isnt spoonfeeding
well yes and no
I don't think client.servers is a thing @earnest phoenix
look at the docs again
I'll send you some more info.
can anyone help me in my bot dashboard?
im trying to let it work on the website, it's ejs
but i don't know really how to let it work
Client.guilds
k thx
when i put the files in the right place it shows me this
i want it to work same as html and the codes and everything is okay
you need html file
you need to render the ejs on your default route
how?
same as the ejs examples you followed, res.render or smth for the app.get('/')
i don't know really so good in programming so i didn't understand
do you know how to use ejs and express
no
huh?
i was trying to make the website for more than 2 weeks now
my friend made the html ejs and used it on glitch, but now i want to use it on a normal vps , i have cpanel
Maybe you should actually learn how to use them instead of jumping right in
@valid holly
// Example function fetching user
const user = fetchUser()
// Voice channel / role association
const voiceChannels = {
"1": "100",
"2": "200",
"3": "300"
}
// Event handler (i didnt check the docs for the actual thing)
client.on('voiceChannelUpdate', (user) => {
// Get the users voice channel
const vChanID = user.voiceChannel.id
// Check the voice channel id is defined
if(vChanID) {
// Get the role associated with the channel
const role = voiceChannels[vChanID]
// Get all role ids as an array
const roleIds = Object.values(voiceChannels)
// Add role associated with channe;
user.roles.add(role)
// If user has role that isn't accosiated with the channel, removed it
user.roles.cache.forEach(r => if(r.id !== role) user.roles.remove(r))
}
})
i want to let it work then i will learn (:
It's voiceStateUpdate iirc
So you want to make a bot dashboard with tools you haven't learnt to use yet, and you want to learn them AFTER you make the dashboard? ok
V-chan 
I need to enter my useless 5 cents okay
@cinder patio because my bot is right now in 60+ servers and i want to make the dashboard asap
how long does the verification take , i have waited over 4 weeks?
shiv, you forgot the period at the end.
then i will learn good in it
@earnest phoenix just wait
Around a month @earnest phoenix
okay
there are many big bots without dashboards, no need to rush
also when im trying to do it i will learn
It's generally a better idea to take a step back and take it slow
to get used to the tools you want to use further
my bot is dying rn so i need to do it asap, from the beginning we said there will be an dashboard in a few days
learning and trying is mutual, you cannot do one without the other
from where could i learn how to make it ?
google is your best friend
i am trying but i didn't yet know how
a dashboard requires knowing many different areas, its not a single thing
@delicate zephyr that's the idea I had intended initially, so I'll go with that, thanks for the support !
boolean = false;
setInterval(async() => {
if (boolean !== true){
client.shard.fetchClientValues('guilds.cache.size')
.then(r => dbl.postStats(r.reduce((a, b) => a + b, 0)));
boolean = true;
setTimeout(() => boolean = false, 60 * 1000);
};
}, 1800 * 1000);
This is being ran for all the shards of the bot so it will be ran x times, how can i make sure it only runs once
tabs im trying to do it
@valid holly No problem!
so you have a webhost with cpanel? is your website made with php?
ok thats a whole lot of new problems
using boolean as a variable name
Might as well call it "x"
why?
why windows vps lol
because it's the easiest
using boolean as a variable name
Might as well call it "x"
@faint prism that isn't the point.
also i host another game server not just the bot on it
yes i have the domain
Get free <nitro image>
what is your website gonna be built with?
im trying to get his discord
php?
ok, so then you need a webserver, like express
@earnest phoenix Is it possible that scopes may happen to be the issue?
are you using express?
a webserver is a program that accepts connections to the host and responds with html files
for example
I have the website files in the linux vps
in Dsharpplus how does one set the activity of the bot
from where do i get express.js
you install it from npm
yes
do you have a package.json?
yes
yes my friend
I'm trying to host my bo 24/7 with Heroku! But when I restart my Dynos, this is shown! Could someone help me?
@quartz kindle it's doing the modules now
check your package.json
@pale vessel me?
@quartz kindle I did them
yes
@pale vessel me?
yes yes yes
me from glitch to a linux vps
no i don't use heroku
Cool
I use heroku 
not you
flaze, hes trying to switch from glitch to centos vps + cpanel and a windows vps to host his bot, and trying to run ejs from cpanel
no
ima bring this up again
any """""""""""free""""""""""" hosting is either:
- not intended to be used as hosting for bots
- not actually suitable for hosting for bots
- not actually free
aeaeae
$3? promise? 😳
not the place to ask
@pale vessel yep but nice story sword fight related family frndly
I can rip off a sword anime
or say boy kill girl
boy liked girl
boy sad
boy become superhero
not the place to ask
Dm me the story
I said this isn't the place to ask
K
Man, I'm still getting A MessageReceived handler is blocking the gateway task
But if I am understanding Tasks correctly, this should spin off it's own task and finish the handler?
Since I'm not awaiting it it shouldn't wait for the result...
Ye
hm not the most experienced in C# but let me take a look
This lead me to think I wouldn't block my handler if I did that without awaiting. Which is what I want
Idk how you do it but I have ```cs
Idk something {
If (message.contents == "!ping") {
await ping(message);
}}
Private Task ping (message){
await message.chabnel.sendAsync("ping is ping");
}```
I'm on mobile so that is not correct for code
But it is what I did for my small c# prohect
Well, if I await the result, which is resource heavy, it'll definitely block the handler
Hmm
What I did for my python bot was create a new thread for the heavy task then I gave it the loop so it could still use the loop for sending stuff to discord but it was out of the loop
If you understand
are you using any Thread.sleeps inside your task @faint prism
no
hm
get mentions first? could you explain?
@faint prism I think theres something to do with await, Task.Run should be awaited if not it'll run sync?
the opposite I believe. It should finish the function without waiting for the Task to finish
yeah thats what I thought too
I think you might be using the gateway/ws threadpool
which might have ran out of threads and blocked
@faint prism wait could you show the remainder/entirety of your code
Well I'm trying out a solution rn, so it isn't production code atm
ah ok
https://discord.foxbot.me/docs/faq/commands/general.html?tabs=cmdattrib maybe this could help?
In the following section, you will find commonly asked questions and
answered regarding general command usage when using Discord.Commands.
the _ = throwaway should make the method run without awaiting the result and finish the function
oh interesting link
does mongodb works same way windows and ubuntu/deb ?
yup
I'm trying to host my bo 24/7 with Heroku! But when I restart my Dynos, this is shown! Could someone help me?
Tell me if needed to see my code
install module?
How?!
^
:D?
by putting it in package.json
What put in package.json?
npm i discord.js
why use heroku btw?
JOKE ^^ don't take it seriously
yeah heroku isn't inheritly for bots
and AFAIK it goes offline
my dad has random 50$ gift cards he doesn't mind losing but not many services for hosting accept gift cards
no

tfw google takes 30% of whatever you earn on google play
yeah

So does apple
MongoDB is so friendly to understand if you come from js lol
I may buy VPS but how can I add it to my bot? I must write something in command prompt or in visual studio code?
A VPS is a virtual computer
but in a fresh vps you have to install node
and packages you can move them using FTP clients like WinSCP or Filezilla
MongoDB is so friendly to understand if you come from js lol
crying irl
I figured it out in like half an hour
but I delayed it for a whole month
Python gang, got a hang of mongo fairly easily 
cause it didn't make sense
I didn't know mongo was a non-sql db, never even read about it
JSON seems pretty much easier to work with than sql
yeah
yea
quickdb is all in one file
more scalable
jesus
try postgres now for a good DB shiv
sqlite file
you'll love shit like PgAdmin 4
I hate writing SQL queries
do try Postgres, trust me

Someday when I start caring about SQL 
sql seems cool
mongo is efficient for my use case
lmao db's are essential to have nowadays
but I prefer mongo
because it works and I have it working
and I don’t need to change it if it works
we just skiped that guy question up there
I also play with my data structures a fuckton so SQL is a bit of a pain in the ass for me
my bot blew up out of proprotion and today i gotta learn scalability for large scale bots, so im kinda fucked
gotta start using redis for high performance checks
@fleet hornet why do you need to put it in one line
Redis for caching?
you should use two different const otherwise it won't make sense
What's the pro of using Redis for caching over direct memory access?
yeah, just do:
const bla bla
const bla bla
im starting to get 1900 spikes per MINUTE on messages
bruh
its insanely faster than a db call
shiv use your brain and explain to him
What's the pro of using Redis for caching over direct memory access?
@slender thistle uh shared access when sharding?
its basically a map from what i've heard
ayo why does this not work?
client.users.fetch("467102802838159370").id
anything else?
mainly shared access
though i'll be giving it a try today
and you don't lose any info if your bot crashes
Shared access between processes
eh so nothing I need to worry about 
you already have the id and you trying to fetch the id (?)
unless you going for big scale
webscale™️
the issue is that i cannot access the object it returns
Hi, I have a question, Is there like a way to reserve a testing channel, like run a command to rent it, or u just enter the channel and just test without permission?
@earnest phoenix if you're talking about this server, then no
it that number goes beyond 3k im kinda fucked
ok
what is your bot for
So Do I just enter the testing server, and just... test?
wait till your bot is approved, you will be able to use it in #commands and #265156322012561408
twitch stats?
Moderation
what do you mean, Cheslin?
Nah, my bot integrates and bridges discord and twitch
so the chat mixes?
not only that
so how do you scale it up
quite a lot more
Await the fetch
Nah, my bot integrates and bridges discord and twitch
@opal plank so is it a twitch discord bot or a discord twitch bot
oh
mmm sounds interesting tbh
neither
I am making a bot named S... OH, i have to have it approved before I test it, o i tho other way around
its a Twitch, Discord AND youtube bot
You can test it in your own server
its a collection of 5 bots working together
damn
Ok @slender thistle
ye ik
interprocess bots ftw
so @slender thistle if I completely redo my bot after its approved its okay right

ok cya until its working 😄
aye we don't care as long as it follows our guidelines
pog
@fluid basin though in fairness the youtube bot needs a massive rework
oof
not sure if its worth mentioning it as a pillar of that collection
there isnt a lib like d.js for it
so i have to manually send requests
its quite a bit complicated work
big brain
tis technically what i did
damn time to test how well will mongodb scale
though im not proficient enough to make a super optimzed lib
remember those days discord was running off mongodb
It scales well
but technically a lib
bet their servers went brrrr
they use postgres now, no?
when was that
cassandra
jo, I need help: why does my bot create over 80 Voicechannels
OOf
old stuff
Client.on('voiceStateUpdate', (oldMember, newMember) => {
if(typeof newMember.channelID === "undefined"){
return
};
let nchannel = newMember.channelID;
if(!nchannel=== voicechannelid){
return
};
if(newMember.id=== "744974832147628032") return;
if(!newMember.channel)return;
Client.guilds.cache.find(g => g.id === guild).channels.create(newMember.member.displayName,
{
"parent":745676919294394369,
"type":"voice",
"permissionOverwrites":[{
id:newMember.id,
allow:["MANAGE_CHANNELS"]
}]
})
.then(console.log);
newMember.setChannel(Client.channels.cache.find(c => c.id === "717376546947596338"))
})
nice rate limit
If I have a method Task MyTask
is calling it by MyTask() the same as Task.Run(() => MyTask()) ?
^^
soz I'm not really experienced in c#
if (msg.author.id == msg.author.id) {
const id = msg.author.id
}
Everything on Discord was stored in a single MongoDB replica set
damn discord
damn
wtf
what
btw does voice state update triger by creating an voice channel
idts @quiet topaz
that was before discords surge in popularity
nono 2015 was the birth of discord
idts @quiet topaz
@fluid basin and how to prevent it?
they migrated in late 2015
wait
I would like to be earlier here so I can have the
thats only 6 months damn
wumpus looks cool with the helmet
@quiet topaz uh I said "I don't think so (idts)"
I'm fairly certain I had nitro in the period for it but I didn't get the badge so idk
@quiet topaz uh I said "I don't think so (idts)"
@fluid basin bruh
but why does it happen
yes
it only triggers when you join a channel or leave
or mute or deafen WHILE inside a channel
wait I haven't finished speaking
deafen, mute,servermute,stream,live,leaving,joining, moving channels
yeah ok
those are all the actions that trigger that event
why are you even creating a channel on VC update though
you need to check em'
bout to get ratelimited if you dont do that command carefully
ok
i dont have nearly as much of a need for cassandra
so you gotta make multiple queries for data across tables
pg been handling fine quite a big stress
the thing is, my data is structured for now but for webscale™️ I can't afford to have a fixed schema
pushing updates will be really hard (without downtime)
how to find out, what trigered that?
compare oldstate and newstate
ok
since you only need joins, check the channel of the state
is there any way to get a bot to screenshare something in a vc
nope
rip
nope
even if you wanted to, discord's modded rpc isn't documented
so have fun implementing it
<:emoji_name:emoji_id>
you can get it by going to the server with the emoji (that the bot is in as well), then add a \ before sending the emoji
how would one go about implementing it lol
oh boy, reversing discord's custom RPC protocol isn't fun

@fluid basin Turns out the behavior I wanted was:
_ = Task.Run(() => LongRunningTask());
Which runs on it's own thread and the calling function continues regardless
For instance
C#
nvm then

And if I await or leave out Task.Run it is blocking
well also de emoji name but... yea ^
its like, making a png image using hex
@fluid basin
stop it, you simply cant use custom emojis in titles and field titles
He's dying inside
ah nice
Yeah emojis are used in Descriptions
Description with markdowns to make titles or whatever
@worthy glacier don't actually bother trying, seriously, its not worth the time
yes ik llol
look docs
let emoji = message.guild.emojis.cache.find(emoji => emoji.name === "cd_disk")
@earnest phoenix ^^^
I know it
oh no
== or ===

Can anyone help me in eval command of discord.py
Ohk
Np
make sure you get permissions correct with who can run the eval command.
const toEval = "Something";
const result = eval(toEval);
That's a pretty verbose command
Np
I implemented an eval in C# 😉
I will find
Hola 
Oka
Behold, the power of CSharpScript and Roslyn API. I give you, eval in C#
so, why does my bot trigger on voiceStateUpdate that move it to a channel and then trigers again (the trigering event is that moving, but you cant move multple times intp the same channel?
It is kinda weird though, you have to pass in globals, and I haven't figured out the namespace inclusion yet
CSharpScript 🤔
It's the class that implements an interpreted form of C# using Roslyn API
So you can essentially run C# via a command
Can anyonr help me? I cant fix this error :c
Error: Status code: 429
at ClientRequest.<anonymous> (/home/DIR/node_modules/miniget/dist/index.js:150:31)
at Object.onceWrapper (events.js:422:26)
at ClientRequest.emit (events.js:315:20)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:596:27)
at HTTPParser.parserOnHeadersComplete (_http_common.js:119:17)
at TLSSocket.socketOnData (_http_client.js:469:22)
at TLSSocket.emit (events.js:315:20)
at addChunk (_stream_readable.js:295:12)
at readableAddChunk (_stream_readable.js:271:9)
at TLSSocket.Readable.push (_stream_readable.js:212:10)
ah okay
Can anyonr help me? I cant fix this error :c
@fast trench jo, code would be good
Wait a Minute c:
is setting status every 5s api abuse?
Otherwise, take a look wherever you are repeatedly calling an API.
Make sure to space out your requests as to not spam
@fast trench
hello
does anyone know how can i fix this?
node_modules/puppeteer/.local-chromium/linux-782078/chrome-linux/chrome: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory












