#development
1 messages Β· Page 1731 of 1
uh, well guess you must handle exceptions next time forth
i have tried chocolatey
cmd, even powershell
stuck for a long time
waiting for log file..
Anyone know any js libraries that allow you to take a screenshot of another website? I'd like something like this because I'm featuring some projects on my website, and I'd like to show a preview screenshot of it, but because I'm updating the projects often, I'd like to not have to take a new screenshot every time I make a change.
Yes, look at puppeteer
Thanks
so i wanted to finally take some steps into upgrading my bot to v12, downloaded the files from my vps.... does this fucking build tools not install.
I'm curious. What specifically is requiring the build tools?
because nodejs doesn't. discord.js doesn't.
upgrading shouldn't require the installation of build tools.
What
Either that's not a real client variable, or it's not discord.js version 12.
i switched to an advanced command handler and idk where to put that
in index didnt work
put what?
if you want to use client, you can either pass it from your main handler to your functions, or you can access it from another place, like message.client or member.client
thats where i have it
ok so you're passing your client to your handlers
show your command_handler/index.js file
this is index
err rather your /handlers/command_handler.js file
Oh wait a sec
yeah that line 4 makes no sense at all
delete that
i had that in my old code
no you didn't, not here, not at this location
it cannot be defined globally
the scope is wrong
ok great, that works
now show the code that handles your incoming messages
something like message.js I presume? whatever handles those
great so
every one of your commands gets the following arguments:
so, in your actual command file
you have access to client.ws
and client.ws.ping
yeah ok so that's wrong
damn
client, message, args, Discord
message, args, client, Discord
you can't randomly decide where these go
functions are called with the same ORDER of arguments
oh
They all have to match.
It's not about being smart it's about having 25 years of programming experience 
im keeping this forever btw
i will
so bc ur so smart
how would i make it say "Purged (specified amount) messages"
I presume you're sending that number in your arguments, so just use that number?
It can only be between 2 and 100 anyway
so it would be this
module.exports = {
name: '!purge',
description: "delete messages!",
async execute(client, message, args, Discord) {
if(!args[0]) return message.channel.send("You must specify how many messages to delete!");
if(isNaN(args[0])) return message.channel.send("Please enter a number!");
if(args[0] > 100) return message.channel.send("The max you can delete is 100!");
if(args[0] < 1) return message.channel.send("You must delete atleast one message!");
if(!message.member.hasPermission("MANAGE_MESSAGES")){
return message.reply("No");
}
await message.channel.messages.fetch({limit: args[0]}).then(messages =>{
message.channel.bulkDelete(messages);
});
message.channel.send(`Purged (args[0]) messages`)
}
}```
only if you actually use a correct template literal
hey, what is this in v12 form? js message.author.DisplayAvatar
wdym
All changes have been documented here https://discordjs.guide/additional-info/changes-in-v12.html
so mine would work or i would have to add ${getCount()}
shhhhhh
try to understand this instead of blindly shoveling code, mmmkay?
hello guys i need help
with?
I don't know, absolute no idea, try to ask their support...
okay
Does anyone know why this code isn't updating the server count on the website?
import discord
import os
from discord.ext import commands, tasks
import dbl
DBL_TOKEN = os.getenv("DBL_TOKEN")
intents = discord.Intents(messages=True, reactions=True, invites=True, guilds=True, members=True, emojis=True)
bot = commands.Bot(command_prefix='!', case_insensitive=True, help_command=None, intents=intents)
bot.dblpy = dbl.DBLClient(bot, DBL_TOKEN, autopost=True)
@bot.event
async def on_guild_post():
await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="users in " + str(len(bot.guilds)) + " servers"))
print(f'Posted server count ({bot.dblpy.guild_count})')
this is python btw
I'd ask the same question
lol
Don't you need to wait 30 minutes before the post is sent?
hey would this in v12: js let muterole = message.guild.roles.cache.find(r => r.name === "muted"); if(!muterole){ try{ muterole = await message.guild.roles.create({ name: "muted", color: "#000000", permissions:[] }) message.guild.channels.cache.forEach(async (channel, id) => { await channel.overwritePermissions(muterole, { SEND_MESSAGES: false, ADD_REACTIONS: false }); }); }catch(e){ console.log(e.stack); } } delete all the other channel perms in the server?
i've heard that a while ago but i am unsure whether that is true
try it
and see
I'll try the manual way instead of autopost and see if that works
bot.dblpy = dbl.DBLClient(bot, DBL_TOKEN)
@tasks.loop(minutes=30)
async def update_stats():
"""This function runs every 30 minutes to automatically update your server count."""
try:
await bot.dblpy.post_guild_count()
print(f'Posted server count ({bot.dblpy.guild_count})')
except Exception as e:
print('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
returns the error
Failed to post server count
TypeError: object Lock can't be used in 'await' expression
why is it using locks instead of asynchronous locks?
Let me introduce you to the superior dblpy, https://pypi.org/project/topggpy
lol thanks
It used to because the module dblpy used was a disaster
Kinda just rewrote it and added it manually
that's nice, should probably change the top.gg python library link to show pip install topggpy instead of pip install dblpy btw
guys does anyone know where to connect our webhook so it can send notifications when someone goes live on twitch?
Sir, i tried it but still same, the bot is welcoming ppl who are joining diff servers
The code:
async def on_member_join(member):
if member.guild.id == 799980929056768000:
pass
em = discord.Embed(title=f"Welcome {member.name}!!", color=0xd24dff)
em.add_field(name=f'Welcome to my World Baby {member.name}!', value=member.mention)
em.set_footer(text="Hope you will have Fun with me here!!!")
await client.get_channel(799980929056768003).send(f'{member.mention} has Joined.')
await client.get_channel(799980929056768003).send(embed=em)
because you did nothing in the if condition body
pass is a placeholder
You should do the welcoming logic in that block
On docs.top.gg?
yeah
Aye, will be done soon
also now that I've unistalled dblpy, and installed topggpy, it says the dbl module no longer exists
How do u make a website for ur bot? Not to customize the bot tho just like The website of giveaway bot
because, it's now topgg 
then change the code on in the topgg docs too please
^^^
You can refer to this until shiv merges it https://github.com/norinorin/python-sdk/tree/patch#examples
A simple API wrapper for top.gg written in Python. Contribute to norinorin/python-sdk development by creating an account on GitHub.
okay thanks
That's all just make a coded website?
there's a bunch of ways to make websites
can be with code
can be with online editors
can be wix.com
can be 100% stolen code you just slap your bot's name on like 90% of bot websites
Not wix nor godaddy
Β―_(γ)_/Β―
if you're making it on your own, then it can be pure html/css/javascript. or you can use a framework like vue, react, angular. Or it can be a backend framework like laravel or django
XD prob just gonna go steal some 1238920201 yr old code and put my bots name on all ofmit
there ya go
But how do I code a website?
all you need is a text editor
with html, css, javascript
html, don't forget to close those tags
But like how do I just go to vs code and code?
yeah
For my eebsite
or just use notepad if you're pro
if you aren't coding in notepad, are you even coding
But how do i make it a website
i think you need to be more specific if you want a clearer answer.
do you mean webhooks and stuff?
read through this https://developer.mozilla.org/en-US/docs/Learn
Welcome to the MDN learning area. This set of articles aims to provide complete beginners to web development with all that they need to start coding websites.
Ugh, I code it then how is it a website like https://botcool
or just a screen that sits there and does nothing
you're lacking very very basic knowledge that you're supposed to learn in school lol
that url doesn't work
but it doesn't work
you need to buy a domain
No...
Freeeeeeeeee
then your hosting off a heroku url which is ugly π
You can change it
lol heroku is nice for ez webhooks tho
as if the link i sent doesn't cover everything you're asking right now π
you need a paid domain ofc
Once you finish writing the code and organizing the files that make up your website, you need to put it all online so people can find it. This article explains how to get your simple sample code online with little effort.
I mean I assume he wants his site to be a little interactive
but also go on stack overflow
and just find all the answers there
i mean all the answers are linked above by cry π
lmao
reading is for noobs, all the cool kids just copypaste the first fragment of code they find praying for it to work
yes but how to make it SPARKLY AND COOOL!!????!?!?
genius
my BOT IS BEST!!!
that was sarcasm
my bot is a panzer kampfwagen mk III
pls why are you writing one liners, that's so unreadable
because less lines of code obv means faster code smh
you can fetch the message after you're done, and go through the reactions and search guild.members and see if they're in there
most accurate way would be to fetch the member
const Command = require("../../base/Command.js"),
Discord = require("discord.js");
class Addcaptain extends Command {
constructor(client) {
super(client, {
name: "addcaptain",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: [],
memberPermissions: ["MANAGE_GUILD"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
guildOwnerOnly: false,
cooldown: 3000
});
}
async run(message, args, data) {
const name = args[0];
if (!name) {
return message.error("administration/addcaptain:MISSING_TEXT");
}
if (name.length > 5) {
return message.error("administration/addcaptain:TOO_LONG");
}
if (!args[1]) return message.error("administration/addcaptain:MISSING_MENTION");
const member = await this.client.resolveMember(args[1], message.guild);
if (!member) return message.error("administration/addcaptain:MISSING_MENTION");
let team = this.client.teamsData.findOne({ name })
if (team) {
const teamData = this.client.findOrCreateTeam({ name });
teamData.captain = member.id;
const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("administration/addteam:TITLE"))
.setColor(data.config.embed.color)
.setFooter(message.author.tag)
.setTimestamp()
.setDescription(message.translate("administration/addcaptain:DES", {
user: message.author.tag,
name,
member: member.user.tag
}));
teamData.save()
message.channel.send(embed);
} else {
return message.error("administration/addcaptain:MISSING_NAME")
}
}
}
module.exports = Addcaptain;
Why i have error in teamData.save()
There is an client.onReady event. But is there a client.onStop event?
This is my client
async findOrCreateTeam({ name: teamID }, isLean) {
if (this.databaseCache.teams.get(teamID)) {
return isLean ? this.databaseCache.teams.get(teamID).toJSON() : this.databaseCache.teams.get(teamID);
} else {
let teamData = (isLean ? await this.teamsData.findOne({ name: teamID }).populate("members").lean() : await this.teamsData.findOne({ name: teamID }).populate("members"));
if (teamData) {
if (!isLean) this.databaseCache.teams.set(teamID, teamData);
return teamData;
} else {
teamData = new this.teamsData({ name: teamID });
await teamData.save();
this.databaseCache.teams.set(teamID, teamData);
return isLean ? teamData.toJSON() : teamData;
}
}
}
ValueError: set_wakeup_fd only works in main thread on linux
I'm trying to thread two apps
in python
and this error shows up
it only shows in linux
and when googled all the solutions are for windows
Can you show how you're running/starting your bot
class Bot(BotBase):
def __init__(self):
self.PREFIX = PREFIX
self.guild = None
self.channel = None
super().__init__(command_prefix=self.PREFIX, intents=intents, case_insensitive=True)
class DiscordBot(Thread):
bot = Bot()
def run(self):
print("Starting The Bot")
self.bot.run(TOKEN)
class FlaskApp(Thread):
def run(self):
if __name__ == '__main__':
print("starting the app")
app.run()
bot_thread = DiscordBot()
flask_thread = FlaskApp()
bot_thread.start()
flask_thread.start()
bot_thread.join()
flask_thread.join()
here
works fine on windows machine
but gives error on linux
Hello, i'm having a problem with my welcome and goodbye message code, it worked perfectly until some days ago it stopped working, can someone help me?
//benvenuto membri
client.on("guildMemberAdd", benvenuto => {
if (benvenuto.user.bot) return;
const benvenutoC = benvenuto.guild.channels.cache.find(channel => channel.id == "826524704579387482")
if (!benvenutoC) return;
const benvenutoE = new Discord.MessageEmbed()
.setColor("#F79600")
.setTitle("Benvenuto " + benvenuto.user.username + "!")
.setDescription("------------------NUOVO MEMBRO------------------------\n:call_me: Ciao <@" + benvenuto.user.id + ">, benvenuto in πππβπ€ ππ πππ¦πππ₯πͺ!\n:eyes: Sei il " + benvenuto.guild.memberCount + "Β° membro!\n:no_entry: Prima di fare altro, leggi il [#826521456157917226](/guild/264445053596991498/channel/826521456157917226/)\n-----------------BUONA PERMANENZA-------------")
.setThumbnail(benvenuto.guild.iconURL())
benvenutoC.send(benvenutoE)
})
//Addio membri
client.on("guildMemberRemove", addio => {
const addioC = addio.guild.channels.cache.find(channel => channel.id == "827838537050357780")
if (!addioC) return;
if (addio.user.bot) return;
addioC.send(addio.user.username + "#" + addio.user.discriminator + " ha preso il volo. πͺ")
})
did you enable the server members intent both in your code and on the website
What's the difference between prototype and adding a new property?
I'm confused, I read the JavaScript learning thing, but yet don't understand much.
prototype adds a new property to all objects derived from it afaik
so like, if you add isNumber() to String.prototype, all strings will have isNumber() function
I don't suggest ever changing the prototype of anything. This was done in the hayday when you couldn't have classe in JavaScript, but... Classes are a thing now, you should use them instead
It's useful for defining extensions on already-existing types.
can anyone help with this error?
whats the error
ValueError: set_wakeup_fd only works in main thread on linux
did u search on google?
and i came across this one too
did u use client.start()?
yeah
all solutions say that using start instead of run solves the error
and then the bot doesn't work
with what error?
isn't that because the user isn't cached?
idk then, but you should address that issue instead of the former
ah so i looked up again and the Docs says
Represents the connected client. None if not logged in.
so how do i connect with client.start?
i thinnk you need to stick it in the asyncio event loop
can u further explain?
its an async function so you need to do await client.start
so you need an async function to run the client.start
checked stackoverflow they say client.start no longer supports
i just tested it and i can make a bot that works
you should use quart instead of flask
quart is flask but asynchronous and with way way less documentation
how do i thread async?
i mean i'm still using flask
Here's an example of some quart/discord bot code
import discord
import os
from discord.ext import commands
from dotenv import load_dotenv
from quart import Quart
load_dotenv()
TOKEN = os.getenv("DISCORD_TOKEN")
PREFIX = "!"
bot = commands.Bot(command_prefix=PREFIX)
@bot.event
async def on_ready():
print(f'{bot.user} has connected to Discord!')
@bot.command(name="hi")
async def hi_command(ctx):
await ctx.channel.send("hello")
app = Quart(__name__)
@app.route("/")
async def hello():
return "hello world"
bot.loop.create_task(app.run_task())
bot.run(TOKEN)
so Quart is the way to go
you can also do
bot.loop.create_task(app.run_task(host=HOST, port=PORT))
sub in your actual host and port for HOST and PORT
I found it easier to deal with b/c it's already asynchronous and therefore you don't have to make a new thread to run the flask app on
it's just a lot harder to find documentation on Quart
like a lot
harder
those are the docs btw
heroku auto assings the ports
the only reason i'm threading
use this then:
PORT = int(os.environ.get("PORT", 5000))
bot.loop.create_task(api.app.run_task(host='0.0.0.0', port=PORT))```
tried and it kills the process
also for the procfile
hypercorn -b 0.0.0.0:$PORT MODULENAME:app
gotta put that for the procfile
oh yeah this
thanks
this will be needed for Quart right?
man i'm suffering since this morning
lmao
like from 10AM
that's not too bad
lmao
i did took few breaks
doesnt show the image and the hearts
`
const Discord = require("discord.js");
module.exports = {
name: 'beso',
description: 'Besar a un usuario',
aliases: ['b'],
async execute( client, message, args ) {
const member = message.mentions.users.first();
const gifsbesos = ["https://i.imgur.com/wGwmCB3.gif", "https://i.imgur.com/gD2lbAB.gif",
"https://i.imgur.com/FGjViBU.gif", "https://i.imgur.com/gjnJuND.gif",
"https://i.imgur.com/N2Vk9A2.gif", "https://i.imgur.com/qatdjzJ.gif",
"https://i.imgur.com/rTmHQtX.gif", "https://i.imgur.com/BycHjfh.gif",
"https://i.imgur.com/5gAwEzp.gif", "https://i.imgur.com/jMZEz5d.gif",
"https://i.imgur.com/Wewugby.gif", "https://i.imgur.com/7rUwGEV.gif",
"https://i.imgur.com/QicmrQF.gif", "https://i.imgur.com/q50sUzB.gif"];
const randomgif = Math.floor(Math.random()*(gifsbesos.lenght));
const corazones = ["π", "π", "π", "β€οΈ"]
const randomcorazon = Math.floor(Math.random()*(corazones.lenght));
if(!member) return message.reply(' β Debes mencionar al usuario que quieres besar !');
const embedbeso = new Discord.MessageEmbed()
.setTitle(` ${corazones[randomcorazon]} Β‘ **${message.author.username}** besΓ³ a **${member.username}** !`)
.setImage(gifsbesos)
.setTimestamp();
if(member) return message.reply(embedbeso);
}
};`
if you looked on stack overflow you could've seen this code exactly
i found that thing
yuh that's me
but i was stuck on flask
recreating arrays on every command 
nah screw Flask, gotta go for that Quart
so in this
modulename is filename right?
and i can remove ports
web hypercorn -b 0.0.0.0:$PORT MODULENAME:app
put that exactly
except instead of modulename put your filename
also if the app is a different name, put a diff name
I am trying to make a global leaderboard for my bot and need to fetch members names, would it be better to use client.get_user or await client.fetch_user?
ok thanks
exports.run = async (message, args, options) => {
const guild = message.guild;
const embed = new Discord.MessageEmbed()
.setColor(options.colors.gray)
.setDescription(message.language.get("SERVERINFO_FIELD")
.replace("{name}", guild.name)
.replace("{id}", guild.id)
.replace("{own}", "<@"+guild.owner+">")
.replace("{region}", guild.region)
.replace("{memberCount}", guild.memberCount)
.replace("{roleCount}", guild.roles.cache.size)
.replace("{channelCount}", guild.channels.cache.size)
.replace("{boostCount}", guild.premiumSubscriptionCount))
.setThumbnail(guild.iconURL({
dynamic: true,
format: "png"
}))
return message.channel.send({
embed: embed
});
};```
Why my .setThumbnail doesnβt work? I have no one error and the guild icon doesnβt display..
try setting the size
Thanks for the help mate but now the shitty heroku doesn't show my servers widget
wdym servers widget
I mean the one discord gives
oh you mean the token?
oh
I have no idea how to work that stuff
I just use quart for a voting webhook
also donation webhook
Same here
Thanks to ya it got working for now
hmm yeah you're gonna have to talk to someone else about website design
U on PC?
Both
A bot and it's server
A friend of mine crated the Server
And I was just messing around with discord bots
what does it do?
For now it does all those simple things
Like setting up Welcome messages
Either embeds or images
oh that's cool
wdym
Hi
This thing
bye
Bye
Why am I getting a
FetchError: invalid json response > body at <url> reason: > Unexpected end of JSON input
``` error when I am sending a request from a vserver but not when I run it locally on my pc
It is the same code nothing changed.. when sending from the server I get the error ... when sending from my pc not
json is invalid
sever might not be allowed to call the url so it gets a no response and then that can't be parsed
likely a dangling bracket or quotation mark
Headers are all set
It is the exact same code I used on my pc
can you ssh into the server and do a curl request to the endpoint?
Wait I try
[PostgreSQL] I have a tags table following a many-to-many relationship. It has a media_id and character_id column which both reference a row on another table (media or characters). I want the tags table to force rows to reference one (and only one) row from another table. So, media_id could have a value and character_id could be NULL, but media_id and character_id can't both have values (and they both can't be null either).
How would I implement something like this?
hello. i was wondering if someone knew why this code // This figures out which day it is var days = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"]; var day = days[time.getDay()]; thinks its one day behind what it is. its the second today but it says its the first
checkout foreign keys
I'm already using foreign keys. I want to see how I can restrict it so only one of the foreign keys are allowed to be present.
UNIQUE
probably because getDay returns 1 and the index at 1 is 2
Could you show an example?
what?
you mean it counts from 0?
that's how lists work
as you can see here. https://i.hitrux.com/P4xFC.png
it counts from 1 to 31
oh wait. im using getday. ill try getdate
yeah ik that, I'm saying it returns 1 and your list's index 1 = 2
what?
my list starts with 01
which is 1
you confuse me
so on until days[30] = 31
i still dont understand
do you know how array indices work?
yes
nop.. not working but why the heck shouldnt the server be allowed to call the url
but if its the second today. why would it return 1?
there could be a whitelist where the url needs to be added
oh it's behind?
wait. i think i fixed it ``` var time = new Date();
// This figures out which day it is
var day = time.getDate();
wack
hm okay
probably timezone stuff then
that was the problem! and no. its not timezone. it cant be when im literally hosting it locally
yeah but does time.getDate() get your local timezone
nop i checked there is no such thing as a whitelist
can you do a curl request to google.com?
fetch("https://w2g.tv/rooms/create.json", {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"w2g_api_key": w2gKey,
"share": "",
"bg_color": "#000000",
"bg_opacity": "90"
})
})
.then(response => response.json())
.then(function (data) {
const NewRoomEmbed = new Discord.MessageEmbed()
.setColor('#8467b8')
.setTitle("A new room has been created")
.addFields(
{ name: `Room Link`, value: `[https://w2g.tv/rooms/` + data.streamkey + `](${data.streamkey})`}
)
.setFooter(client.user.username, client.user.displayAvatarURL())
.setTimestamp()
message.channel.send(NewRoomEmbed);
})
.catch(error => console.log(`Error on 'w2#create': ${error}`));
thats the code snippet.. on my pc it works fine but the same code on server gives the invalid json body response
"w2g_api_key": w2gKey,
"share": "",
"bg_color": "#000000",
"bg_opacity": "90"
}' 'https://w2g.tv/rooms/create.json'```
what does the curl respond with?
one moment
be careful not to share your api key
does anyone know if it's possible to know who installed your bot to the guild?
i am working on install flow and I don't want to send DM to the guild admin but rather to the person who added to the server
yeah
I dont think it is. the guildCreate event only gives you a guild object.
https://gist.github.com/koad/316b265a91d933fd1b62dddfcc3ff584#file-discordjs-cheatsheet-js-L141
I am not familiar with curl so I don't know if this is the output I am looking for
//Edit: on reqbin It responds with a 403 error
I am not familiar with bots in discord in general, but when you install a new bot how do you configure it? does it dm you or it dms to the owner?
it can't resolve the host. the server must have some sort of whitelist or firewall that needs to be updated
when you invite the bot it asks for which permissions to give it. it doesn;t DM the owner
well should i just add the ip from www.w2g.tv to the firewall or is there a specific thing for these kind of urls because w2g.tv can be resolved in cmd idk
I am not talking about the default behavior, but rather about best practices.
That doesn't seem to solve my problem, but thanks regardless
I noticed that for many websites, under their "Partners" section, they have the logos of their partners in grayscale, and when you hover over them, they fade into color. Anyone know how I could achieve that effect?
The hosting provider must have some sort of ui to update the rules. what provider are you using
nop there is none
Do you have a running Discord bot where when it's invited, you want to DM the inviter, or are you doing something else? With bots, it is possible to know who invited your bot via audit logs (assuming you have permission to view it)
Yes, I wanted to DM the inviter, both for already installed and newly installed guilds. But I don't want to request audit logs permission.
I don't think it's possible to know who invited your bot without audit logs permission.
does anyone know how to make a discord bot play music in a stage channel since that i saw rtyme do it i want to know
and i use distube for the music
you'll have to modify your library
or wait for the lib maintainers to implement it
i went to the offical distube server to suggest it and they said no
you can start it in another vc and then move it to the stage channel and then invite to speak
that's how I do it at least
because distube is a library for lazy ass developers that integrates with djs
they aren't maintaining djs
ill just wait intil discord bot dev youtbers post vids on how to do it
lmao
I mean this way works
im not in a rush just looking for things to improve
on my bot
Who decided that ! was going to be every frickkn prefix for bots
newer devs
What did it used to be
Nah, like ! is more common for newer developers to choose for their bot
imo ! is only nice in development, but as soon as it hits production please don't use !
I like / but my first bot uses $
Why not use !
it's very common
The new slash commands?
Yea
I haven't tried those yet, but yeah, they're nice for getting rid of prefix problems like that
Can i manage a bot without vds?
vds?
It is an securiate system and a machine for shard
as far as I know
And they're not jokes. They're just not appropriate for hosting bots.
I see your baby, editing that message to look less like a 
actually, he probably means VDS
virtual droplet server
aka digital ocean
no, they're shit for long-running apps like bots
I have a vps from https://servercheap.net
Hosting starting at $2.99/m - Servercheap.NET is a fast and reliable virtual private server platform, designed for serious developers.
Paid in Bitcoin
Like $60 in total
Run a bunch of stuff on it
1gb?
Yeah you shouldn't need more than that
I got 2gb I think
And on sale
"shouldn't" 
Cmon one of my friends ran a discord bot off a raspberry pi
the specs don't help too much also
I mean, if your name is Tim you can survive under 1GB quite long
but you need to sacrifice A TON of caching which will make the bot sluggish
Yeah here we go
then there's this
It's not expensive but it's not ideal
not ideal???
My stuff is fine on my vps
how are that 1GB 1CPU specs ideal then?
I have 2gb 2cpu
And it's cheap
$4 a month or whatever
I guess it's not that bad
But
I'm fine
for now
what does latency have to do with specs?
latency depends only on distance to server
it's user -> discord -> bot -> discord -> user
And where you think the response is going and how discord knows to send the event

How you think the bot can update the latency when it already sent the message
what
The user sends some data -> discord receives and processes it -> your bot receives the data and you process it -> discord receives the response from your bot and processes it -> the user receives data (which was emitted by your bot)
looks like the width isnt set to 100% so it's using the minimum amount of width
by default a flex box will shrink to it's smallest possible width without wrapping content
Use absolute position
please god dont
I'm KIDDING
lol ye no, ik
This is basic css
well by default align-self applies to the vertical axis
float: right;
unless it's flex column where it rotates basically 90 deg
also called a roundtrip
apparently just needed margin-left: auto
BotGhost 
that'll work but might not be optimum
if you want anything else to go right it'll affect it's siblings
then give me optimum solution π’
flex

^
ima do it in tailwind so it's easy to write out rq:
<nav class="flex justify-between w-full h-16">
<div>left</div>
<div>right</div>
</nav>
there's like -1 reason not to use flex nowadays
the nav child will inherit the parent's full width
The -1 reason is any fed website
fed websites don't even have css
did someone say vulnerabilities?
Yeah
Why use iframe when you can use frame and html4
--yolo

we dont spoonfeed here
:o
against the rules
DID SOMEONE SAY VULNERABILITIES
Ok can someone help me make one?
Back to stackoverflow π
CSS(Cascade Styling Sheets) has casdade in the name because you make one minor change and it will cascade all the way down detroying everything in its path 
what could go wrong making this box smaller?

Well yeah you could use Heroku, Repl, Glitch etc but it's not recommended
Save up and buy a vps
They cost $2-16 a month
more like $1-$300

or for free if you have a credit card
aws offers a 1 year trial if you use ur credit card
also f1' micro from google
Try heroku it gives 550 hrs a month per repository and if it runs out, just make a new repository if you plan to pay nothing on bot hosting
heroku is ass
It also gives u two free instances permanently.
np
what the fuck is wrong with my Northon and my PC security system? it doesnt let my close my apps, says this app made a suspiciaus action. Rish: Hight
ITS JUST TRYING TO CLOSE IT TSELF
He he he... imagine using an external anti-virus application decreasing your system speed dramatically and sharing your system Information and your activities to help to "improve" their apps.

Can someone help me
im getting these random null messages spamming on my console tho i dont know where the origin of where these are coming from
code? lol
it has something to do with your code, not normal node
prolly a loop kek
im not sure what part of my code is coming from xd
Right click root -> find in files -> console.log
Pretty much any routine task
mmh mmh
so a event probably
Cron, loops, setInterval, events and commonly called methods
hmm π€
Just search the whole project for console.log
It shouldn't tbh
MonkaS
Console.log should never make into production
Why all of this pain
right
I just tried pushing an official update for my bot, and it's telling me that my port is already in use
I'm not sure what's listening through this port other than myself
The only thing the update did to my DBL cog was make it give me some items when it receives a vote
It's giving me OSError 98
I have my bot on a runner, and it restarts every time I restart the Pi
That's the only way I can restart the bot
I don't see how another program is running around through my port
Could anyone help with this?
Make a proper shutdown sequence instead of ctrl + C
I don't use control c
I literally just restart the Pi to restart the bot
it's a runner
Like, you can just shutdown the proccess
a startup process
I've found that restarting the process via suo systemctl restart doesn't work very well
huh?
But before that, close all streams and terminate background tasks
Like, you know that all languages have some sort of exiting the process right?
I'm not exactly the best at Ubuntu Server and Raspberry Pi
yeah
and how do I start it again
Just run the file?
That still doesn't help very much with the current problem
How can leftover processes exist if I stopped all running processes and restarted the Pi
wouldn't recommend it but I deal with these quite a lot. D:
You don't fix printers, you convince them to work
Tis true. My job is also convincing the old people that it's not fixable bec fuck printers
Also everytime you disassemble one and reassemble you end up with more screws than when you started
But anyway @crimson meteor, try running fuser -n tcp -k PORT to see if it solves your issue
That'll kill whatever is running on that port
And tell you what it was
oh btw we ended up uses the borders you sent me π tyvm. Each rarity is it's own border now.
also it didn't end my bot process
Yw
Then nothing was running on it
What port does it state that's in use?
My code states it's using 5000
Ok, 5000 is safe
Afaik
Aren't u starting two webservers in the same port in the code?
I can't think of anything else
@mighty ember
heroku seems to be fine for me
i ran a bot with almost 1k servers on it
worked fine
no issues
yes, so does using a single JSON file to save data, but it's not fine in some hidden ways
just slow with updating from github thats all
willing to try testing my API? (it makes a graph)
it makes graphs. How does one request?
https://calcu.botbox.dev/graph?function=<<insert function here (do not include "f(x)=")&limits=<<x axis limits (only put 1 number)>>
a get request
or typing in discord replaces with an image
ah, so you used python
yep
that's cool, haha, good work!!
it's really easy, except to make it good
and i already had the code to graph a function for my actual bot
just needed to add images for it
mhm, you could add more types of graphs
i plan to
its a good idea because people can make graphs using any other programming language
that's pretty much the whole point of the API
cool, you made any wrappers for the api?
if i make it public, i'll need to have API keys to limit people
not sure
i have no idea what that means
Yep, Jwt
like packages so that people can easily use your api
yeah like pypi has packages
nah, its cool
if you wanted to, i could say that yours is the official one (sort of official)
python doesn't need one because matplotlib is python
you should also ratelimit the api, like 50 requests per minute or somethin
i could, but not yet
yeah
it does lock for now, and delays all requests if one's in progress
what language(s) do you use/know?
I'm more of a gopher, and I know nodejs
okay
did you use flask, for the web server?
if you make it public any day
may i ask something. I'm new here.
How do my BOT get approved?
soon, actually
it'll go along with my bot
go over to https://top.gg/, login and then add bot which is on the header of the page
good luck!!
I already add my bot. is there anything I should do to get it approved?
want to test it/help with it later? (if so, PM me)
it will take u about 2 weeks to get verified
sure haha
Does anyone know a good coloration site for programming?
Ah, I see. I just need to wait then. Thank you for the answer.
yeah, np!
like wdym? Color schemes
Auto correct was at it again *collaboration
github doesn't have a feature that allows multiple people to work on it live?
use vsc live share
Sorta un reliable
and regardless live collaboration coding never works well in scale and shouldnβt be used to create a creation workflow
you should stick to simple git and have certain people take on certain projects
if you want to do a one off coding session with your friend or something vsc live is your best bet
repl make me happy (not judging any body)
I'm making something similar to top.gg's voting system. But I'm thinking about how to implement a monthly reset of votes. Is it the best way to reset DB values ββusing cron?
Top.gg probably checks for last vote timestamp on vote and in case it was from previous month, reset monthly votes and then append the current onr
I should compare timestamps and use cron for reseting vote counts and user vote cooldown for every month.
Thanks!
hello this is my code how could i make it send it every 10min
in a specific channel
??
Can Δ± do shards with BDTM
Where is that email part located???
this is a great way to completely fuck up your bot
ikd how experienced with js you are, but you do realise the implications of what you just wrote right?
..
EVERY time someoen sends a message, it'll start a new loop to send messages in the channel. Now, heres the fun part, if someone were to dm your bot 40 times, or if you leave ur bot running for an hour, you'll like start spamming your bot which will lead to ratelimiting
also, message isnt even defined there
you calling a function but are not passing the parameters
nor is channel
where did you copy that code from?
........
i dont understand dotlanguage, sorry
Hi


@opal plank how did you do your state
Ok thx
np
Can i use shards on BDTM
dunno what that is
<β’β’β’>
another one with dotlang
guys how can i connect a webhook to twitch so it can send a message when someone is live?
twitch should have webhooks already for that
how do i connect it to my discord server
you can use this if you dont wanna code it yourself https://gist.github.com/smiley/78c1c2a57d17a179a978a1438b389710
How to make an automatic "stream's live" notification for your Discord server - README.md
ok thanks
... but like... it's on that site? You want to scrape it from a site
botumu doΔrulayΔ±Δ±Δ±nn
english?
verify my bot
but how
let's
let's let's
let's!
;_;
@tardy hornet my verify boooooottt
what ping
guild.channels.set(channel.id, channel);
TypeError: Cannot read property 'id' of undefined
what is error
anyone?
Any cn come to review my bot personaly
what's your code look like
why don't you use mod to check week, then day, then hour, then minutes, then seconds?
instead of hour then week then day
is there a way to get scopes allowed in a guild?
when you invite the bot, like slash commands scope, bot, etc
wdym, there's the oauth link that lists the perms you should give a bot
these
it is indeed oauth, but i cant find proper way to see if i can add slash commands onto a guild
speciffically this
click bot and in there are slash commands
wait what?
theres only a USE_SLASH_COMMANDS bitfield, there isnt one for checking if i can register slash commands onto a guild tho
thats why i'd need to know if the bot was authorized
bento
i dont want to generate an invite
i want to check if the bot has permission to add slash commands
oh you wanna see if it has the perm
2 different things
,
unless its merged with MANAGE_GUILD or some other perm
but im not findingh anything in the docs for it
guild.channels.set(channel.id, channel);
TypeError: Cannot read property 'id' of undefined
that error isnt coming from that line, the error shows the channel being undefined, not guild
also guild might be undefined, dm messages for example
no
i have the csv file
I just used an online csv viewer
don't think there is a way to check, only way is to see if an exception is raised
Scopes?
hmm
yeah
to create slash commands in a guild
theres no permission for it
only USE_SLASH_COMMANDS
Is there any way to check your scopes within a guild?
good question, thats what im looking for
like i said, unless its bulked into a permission like MANAGE_GUILD or something
but i highly doubt it
don't think it's in one of those
I think the only way is to just try except or try catch
might go bother cake evan or advaith to see if theres some super secret endpoint for that
there has to be a way to check it tho
https://discord.com/developers/docs/topics/oauth2#get-current-authorization-information this won't help, will it
Integrate your service with Discord β whether it's a bot or a game or whatever your wildest imagination can come up with.
Aye rip
and i do that how?
let totalSeconds = (client.uptime / 1000);
let weeks = math.floor(totalSeconds / 604800);
totalSeconds %= 604800;
let days = Math.floor(totalSeconds / 86400);
totalSeconds %= 86400;
let hours = Math.floor(totalSeconds / 3600);
totalSeconds %= 3600;
let minutes = Math.floor(totalSeconds / 60);
totalSeconds %= 60;
let seconds = totalSeconds;
let uptime = `${weeks} weeks, ${days} days, ${hours} hours, ${minutes} minutes and ${seconds} seconds`;
that would work right?
np
can anyone help
I have a csv file
I want to read data
from that file
and for each email send a mail to that email using nodemailer
how can I fetch the dta
how add emoji in bot
get the emoji's id
it cnt work in other server
it will, you need to do \emoji and it will send something like:
that
I am on mac tho
textedit
okk
your bot needs to be in the server that has the emoji, and your bot needs the USE EXTERNAL EMOJI permission
it does not have to be in a server that has the emoji
I cant send it here because it has a lot of emails
it just got to have USE EXTERNAL EMOJI permission @quartz kindle
it does
Comma or no comma thatβs the question to split your CSV
no it does not
this is how it does all stuff
i use it
last time i checked it did need it
any ideas about my prev question?
like this
how else will it be able to access the emoji
There you go , is the delimiter
oh
mmm, commas
And ; inside for more than 1 argument
all it need is the USE EXTERNAL EMOJI permission and he can just do:
its a separator
what question?
You SPLIT by commas and the items of the array by ;
idk anything about slash commands, remember?
but a lot of commas are there
Yes check if the item is empty or not
frick, right
The structure is always the same
a csv file is like a table
Can I use https://www.npmjs.com/package/csv-parser
you open the file
split by new lines
then each line you split ny commas
and you have the table in a 2d array
Itβs getting more complicated using a parser than simply splitting the items separated by a comma already
this doesnt look very cvs'y to me
yes thats exactly how csv looks like

I can use parser seems easy
// [
// { NAME: 'Daffy Duck', AGE: '24' },
// { NAME: 'Bugs Bunny', AGE: '22' }
// ]
why wouldn't you use a parser?
you want some? 


that gif KuuHaKu made is invaluable
hey! Why is my code not working? js var pStart = now(); message.channel.send(":ping_pong: Checking ping... please wait :clock1: ").then(message => { var pEnd = now(); message.edit("Current latency is " + (pEnd - pStart).toFixed(2) + " ms and the current websocket ping is " + client.ping.toFixed(0) + "."); }).catch(error => console.log("Error executing ping command:\n")); };
is it because the .then is deprecated in v12?
i have to await it now right
no lol
owh





