#development
1 messages ยท Page 1351 of 1
anyone know a good example of a multi-lang bot?
right now i know roughly what i need to do but im not sure how to like pass through variables
(well, i do but my way feels messy to me :1)
@earnest phoenix it didnt work
@misty river it's ez
{
"GREETING": {"en": "Hello!", "fr": "Bonjour!"}
}
@restive lily did you pass it to your bot constructor?
yes
can you show the full intents code including the bot constructor
import discord
from discord.ext import commands, tasks
from discord.utils import get
import asyncio
import datetime
import sys
import traceback
import random
from itertools import cycle
import json
import platform
import os
def get_prefix(client, message):
with open('prefixes.json', 'r') as f:
prefixes = json.load(f)
return prefixes[str(message.guild.id)]
intents = discord.Intents.default()
intents.members = True
bot = commands.Bot(command_prefix = get_prefix, case_insensitive=True, intents=intents)```
what about your current on_member_join code
@bot.event
async def on_member_join(member):
await member.add_roles(discord.utils.get(member.guild.roles, name="Syndicate Members"))
await member.add_roles(discord.utils.get(member.guild.roles, name="In Training"))
channel = discord.utils.get(member.guild.text_channels, name="sydcranklogs")
await channel.send(f"`Syndicate Members` and `In Training` was given to `{member.name}({member.id})` by `Auto Role`")```
did you make sure your bot hierarchy is higher than those roles?
mhm, when ever have a hierarchy issue i get a console error and its the highest role with admin perms
and these are checked
can you put a print in on_member_join to see if its getting triggered?
its getting triggered
but it doesn't add roles and not sending any messages?
do you happen to have a global error handler? on_command_error event
i do not anymore
hey
whats wrong with my command
const { MessageEmbed } = require('discord.js')
module.exports = (client) => {
const channelId1 = '767604190439669801' // Welcome Channel
const channelId2 = '769792836006051840' // Farewell Channel
const ruleChannel = '767604190439669801' // Rules Channel
client.on('guildMemberAdd', (member) => {
let avatar = member.user.displayAvatarURL({ dynamic: true })
const greeting = new MessageEmbed()
.setTitle('New member! Let\'s welcome them!')
.setDescription(`Warm welcomes to <@${member.id}>! :partying_face: / We hope you enjoy our server!`)
.setThumbnail(avatar)
.setColor('#77dd77')
.addFields(
{ name: 'Essential Info:', value: member.guild.channels.cache.get(ruleChannel).toString(), inline: true }
)
const channel1 = member.guild.channels.cache.get(channelId1)
channel1.send(greeting)
})
client.on('guildMemberRemove', (member) => {
let avatar = member.user.displayAvatarURL({ dynamic: true })
const farewell = new MessageEmbed()
.setTitle('A member just left!')
.setDescription(`<@${member.id}> just left the server... ๐ง`)
.setThumbnail(avatar)
.setColor('#ff6961')
const channel2 = member.guild.channels.cache.get(channelId2)
channel2.send(farewell)
})
}```
whats wrong?
with command?
you gave us no info on what was wrong
whats wrong?
@fathom nymph you tell me
Its Umm
whenever someone joins
My bot crashes
and it wont send the inv
I mean
embed
that's not an error message
that's a vague description that eludes everyone
how about on_error? @restive lily
hmm, well there isn't a reason for your code to not work, unless it's rate limited
can you add to the rich embed if you declare it as a const like that?
ty for the help
okie
let user = message.guild.member(message.mentions.users.first()) ||
message.guild.members.cache.get(args[0]);
if (!user) return message.channel.send("I couldn't find that user");
``` this is not working when i use id
did you try to use .toString()???
toString() a string 
I made a command that enlarges emojis using a command but it's not working on the default emojis like ๐ณ or ๐ฆ Whereas it's working on custom emojis like
. I am sending my code too.
I want to make a welcoming message for the bot, like dank memer, who messages in the top channel it can type in
Can anyone guide me in-depth of how to host my own mailing server on debain os
question
async def enlarge(ctx, emoji: discord.PartialEmoji = None):
if not emoji:
await ctx.send("You need to provide an emoji!")
else:
embed = discord.Embed(title = "Enlarged Version of the emoji!" , description = f"Emoji : {emoji.name}")
embed.set_image(url = f"{emoji.url}")
await ctx.send(embed=embed)```
Please help me
if (msg.content === '!meme') {
exports.run = async (client, message, args) => {
try {
const { body } = await snekfetch
.get('https://www.reddit.com/r/dankmemes.json?sort=top&t=week')
.query({ limit: 800 });
const allowed = message.channel.nsfw ? body.data.children : body.data.children.filter(post => !post.data.over_18);
if (!allowed.length) return sg.channel.send('It seems we are out of fresh memes!, Try again later.');
const randomnumber = Math.floor(Math.random() * allowed.length)
const embed = new Discord.RichEmbed()
.setColor(0x00A2E8)
.setTitle(allowed[randomnumber].data.title)
.setDescription("Posted by: " + allowed[randomnumber].data.author)
.setImage(allowed[randomnumber].data.url)
.addField("Other info:", "Up votes: " + allowed[randomnumber].data.ups + " / Comments: " + allowed[randomnumber].data.num_comments)
.setFooter("Memes provided by r/dankmemes")
msg.channel.send(embed)
} catch (err) {
return console.log(err);
}
}
}```
:c
Yea more like you copied
no :c
I want to make a welcoming message for the bot, like dank memer, who messages in the top channel it can type in
how could I make it
i mean exports.run shouldnt be there or msg.content thing idk what ru tryin to do
is ur bot only an a file? @fathom nymph (like bot.js)
but why is there exports.run
I want to make a welcoming message for the bot, like dank memer, who messages in the top channel it can type in, any suggestions
@sick fable discord default emojis can't be viewed like custom emoji's
let user = message.guild.member(message.mentions.users.first()) ||
message.guild.members.cache.get(args[0]);
if (!user) return message.channel.send("I couldn't find that user");
``` this is not working when i use id
they're all svgs
So how should I fix it? @trim saddle
I want to make a welcoming message for the bot, like dank memer, who messages in the top channel it can type in, any suggestions
My friend coded a bot which enlarges default emojis too
I want to make a welcoming message for the bot, like dank memer, who messages in the top channel it can type in, any suggestions
I guess none huh
Lmaoo
guess I'll go somewhere else then
if (embedf.fields[3].value.length > 1024) return message.channel.send('you got more roles then i can list. Must be 1024 or fewer in length.')
TypeError: Cannot read property 'value' of undefined
I want to make a welcoming message for the bot, like dank memer, who messages in the top channel it can type in, any suggestions
@ancient nova You didnโt provide your coding language, lol
embedf.fields[3] is undefined
oh yea
I want to make a welcoming message for the bot, like dank memer, who messages in the top channel it can type in, any suggestions? (discord.js)
not my choice but if i wouldn't make it look like it's the users fault if the field is too long
make some sort of workaround
I want to make a welcoming message for the bot, like dank memer, who messages in the top channel it can type in, any suggestions? (discord.js)
@hasty mulch none again
Best to ask in the lib Discord server
which is?
message.guild.owner.tag
when in doubt
<client>.users.cache.get(${message.guild.owner.id}).tag
Object.keys(message.guild.owner)
or
https://discord.js.org/#/docs/main/stable/class/Guild?scrollTo=owner
Could someone ping cry plz
guild has the property ownerID where you can use guild#members#fetch(guild#ownerID) to get the owner
@earnest phoenix
@slender thistle don't cry bbcakes
Yo cry, was it you who had the URL with default Discord unicode emotes JSON?
Mf cry I know you're lurking in invis 
oh, you mean this? https://static.emzi0767.com/misc/discordEmojiMap.json
I want to make a welcoming message for the bot, like dank memer, who messages in the top channel it can type in, any suggestions? (discord.js)
@ancient nova if you provide us a code, then All those who know JavaScript will come to help you.
"We don't spoon-feed" ~ Shivaco
Thanks flaze

for me, i use string.codePointAt() and https://github.com/twitter/twemoji/raw/master/assets/72x72/<unicode>.png
"We don't spoon-feed"~ Shivaco
@sick fable @slender thistle I guess you said this quote

I was pestering people for spoonfeeding at point, yeah
.codePointAt... should be ord() in Python
Unless I'm completely and utterly wrong

it seems to be
@sick fable I am asking for the command? why would I mention that I want to make it like dank memer, I don't know how to make it dm the top server
sort your servers
same deal
console.log(message.guild.members.cache.get(args[0])); //undefined even tho i put real id
you mean the channel at the top of the hierarchy?
in there you put a code to tell it
to find the id of the
top channel in the guild it just joined
so after that
like channel#position?
you take that channel id and cache it with your client
and tell it to dm a welcoming message
sort by channel#position or just use .find()
i wouldn't rely on using the top channel
then how else am I supposed to do that
rather the first channel you can chat in
mhm
hi, im new in here
hii
when do i use message.guild.members.cache.get(args[0]) or message.guild.members.fetch(args[0])?
Alrighty, I coded this command too. It adds the emojis automatically to the guild. The code is as follows followed with the error:
Code - @client.command() async def addemoji(ctx, emoji: discord.PartialEmoji, *,name): guild = ctx.guild await ctx.guild.add_emoji(emoji, name=name) await ctx.send("Succesfuly added the emoji!")
Error- discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Guild' object has no attribute 'add_emoji'
@sick fable it would be create_custom_emoji https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild.create_custom_emoji
Thanks โค๏ธ
@sick fable is your bot open source?
well, that's not the step still, you need to convert that partial emoji object into bytes for the image kwarg so that it can be created into an emoji
Kk
how do i fech the guild that has the least members
@earnest phoenix bruh
yes?
if you talking about kwargs and bytes one more time i'm wrapping you in an envelope and sending it to brazil
๐ฆ
?
@sick fable is your bot open source?
@dawn ether yes
you heard me
off topic lol
@dawn ether yes
@sick fable where is it? in your github?
@sick fable where is it? in your github?
@dawn ether nah, it's not open source. Sorry, I was watching Interstellar so I was a dumbass at that time
How do I send a message to the first channel the bot can send a message in
which library? @carmine summit
js
dumb question
whats that thing you put into const bot = new Client() that gets all the members
dumb question
@astral yoke true
@astral yoke https://discord.js.org/#/docs/main/stable/typedef/ClientOptions { fetchAllMembers: true }
One message removed from a suspended account.
One message removed from a suspended account.
is npm i ffmpeg
@tardy hornet you can open npmjs website and get how to install ffmpeg
One message removed from a suspended account.
and nor should source code it cat
anyone know why this dosent work
bot.on('guildMemberAdd', async (member, message) => {
let test = bot.db.get(welcome_${message.guild.id})
bot.channels.cache.get(test).send("welcome test")
})
the welcome is set as an id of a channel
dumb question
@astral yoke ??
Can i get giveaway coding
@modern osprey we don't just give code to people
Read rule 8a of server rules
One message removed from a suspended account.
it's spoonfeeding
Spoonfeeding is bad
You won't learn anything if we just give you code
I need something that sends a message to a channel that the bot can send a message in once by guild
Something like Hello Thanks For Adding Me Into Your Server. Type In ?help To Get Started
you can also just get the first channel using .find(), it's probably faster, not sure tbh
cause filtering involves the whole collection/array
yo anyone knows how to use mongoose to find which has a value in a object like this
Model = {
premium: {
valid: true,
code: ''
}
}
i want to find every documents which has the valid true
oh jeez add some indentation lmao
.-.
TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received undefined
means url doesn't exist, either u passed something that is undefined or didn't pass anything at all
Talk to europa's developers
Where are they?
In their support server probably
Oh, so it's not.... okay
means url doesn't exist, either u passed something that is undefined or didn't pass anything at all
@tame kestrel want me to send the command?
I mean if you want, I think you're smart enough to experiment around and find the error yourself
Does anyone has experience with mongoose?
Do you know how to add a Field in a document?
@tardy hornet did u put the url into a string?
hi
@tardy hornet from your code, you not use youtube api, on your case you must input youtube url or video id
@astral yoke guildMemberAdd doesn't give message (what message would it give anyway?). you can use member.guild.id instead in order to get the guild id
what i want it todo is right now im testing it, so im trying to get it to send when my alt joins
changing it to member guild id dosent fix anything
it dosent even do anything
Self bots. This shithead was trying to raid my server
the guildMember add isnt working
i might know why @astral yoke
If I can get some help, lmk
is your bot verified?
Nope
did you add the guild members intent?
its a client bot im making it for someones server
you need it for member join event
in the developers page?
Discord embeds can not contain tabs can they?
im in a description where i want to line things up
but \t or \u0009 don't seem to give the result i want with tabbing
in the developers page?
@astral yoke try checking there, it's greyed out for some people so i'm not sure what it'll look like for you. after that, add it under your clientoptions too
i think your right
well, you DO need it
all good

๐ anyone can help me with these tabs?
flaze u'r best ๐ต๐ฝ
Discord embeds can not contain tabs can they?
@peak venture they can't iirc
but you can use a pagination system
(not an official thing just a simulation or smth)
Pagination?
a system where a user clicks reactions to go through different pages
idk how to make that ask tim the saviour
they meant tabs as "indent"
ah yea; but that's not what i'm looking for though ๐
they meant tabs as "indent"
@pale vessel oh ok
i'm having a description that needs a split of space
wouldn't \n suffice?
wouldn't
\nsuffice?
@pale vessel that would create a new line instead of a little bit of space between two characters
i see
red stripes need to be more tright
you can use alternative characters
i was using blank spaces from the webpage
wait i think i just found a bug in discord PTB
though now i got multilangual bot the spaces dont suffice any longer
time to test and report
yea flaze ๐
i've been using the same too
but as i said; since i started with multi languages this wont longer suffice
so i was hoping to see wether someone had a solution to create the tab
that'd result into addfields hm
what do you mean?
i'd codeblock the titles then and codeblck the results
to get that even effect
but that's simply not possible
can't you put them all inside a single codeblock?
would that even straighten it out?
no worries
how come i keep getting this no matter what i change (node:18592) UnhandledPromiseRejectionWarning: TypeError: (intermediate value).setTitle(...).setDescription(...).setTimeStamp is not a function
bot.on("guildMemberAdd", async (member, message) => {
let embed = new MessageEmbed()
.setTitle(`welcome`)
.setDescription(`desc`)
.setTimestamp()
let welcome = db.get(`welcome_${message.guild.id}`)
bot.channels.cache.get(welcome).send(embed)
})```
?
the error seems to be coming from here
but
can you like try saving and restart the bot
I have auto save on
the code isn't saving, probably
if you look at the error
OR that it came from somewhere else
try adding it back
my botinfo and status has gone down
like
it was at 1200 members
and its dropped too 1
but its still in ever server
every&
and im not sure whats wrong with it
can you give your bot info status code of member ?
so its only counting the bot?
can you give your bot info status code of member ?
@neon heart nah
is your bot verified?
no
what intents did you put?
well to get it verified
@pale vessel
bot.user.setActivity(`Total Users ${bot.users.cache.size} | Total Guilds ${bot.guilds.cache.size} | /invite /support`, { type: 'WATCHING'})
});```
what intents did you put?
to count the bots guilds and total users?
go to your bot application in discord developer portal
select bot and see if you turned on the guild members intent or not
@quartz kindle Does JS ASM exist?
@earnest phoenix WASM exists, idk if that what you mean
@earnest phoenix message.guild.members.cache.filter(x=> x.user.bot).size for get bot count
Guild member intent is required for the guildmemberadd event right?
yes
i think pretty much anything that sends members over gateway needs the intent
you can however fetch a member via query without the intent

are you sure
how do i fix this error
'(' expected.
but there is }
re check your syntax
well.
that } is from client.on('message', message => { if(!message.content.startsWith(prefix) || message.author.bot) return;
but the error says expected )
show your full code
@earnest phoenix yeah, only needed if you want the entire member list
Shouldnโt the arrow function expression be in ( )?
it's optional if there's only one parameter
lol flaze
Ahh ok, wasnโt exactly sure
that's hilarious, bots can still scrape data by sending the gw request in chunks 
get trolled by discord
at least presences aren't like this
The error is at line 67
ohh
i forget to add it
dumb me
that if else defeats the entire purpose of your command handler 
at least it wasn't bunch of message events dumped together
ban command
create a context object that stores your arguments, i.e. the message, the client etc
let cmd = get(some command string)
if(cmd)
cmd.execute({
message: message object,
client: client,
...whatever you want here
})
your command handler compressed in just a few lines
ok
please don't copy paste that
i really hate ifs without brackets lmao

i can see that in discord.js-light source
xD
but muh easier to type
Means to be a fake statement
FakE statement ;)
if(!member.user.bot)
{
member.send(text)
} ```
hey guys it is saying member not defined ```help me please ```
yeah no thx :^)
ahh i was asking for help
@pulsar bone member is not defined
ew
define member 
thats the answer your question
lmao
the error is literally telling you whats wrong
? i am newbie i dont know
you tried to use member where member doesnt exist
you need to get the member from somewhere
member is in discordjs
member is in discord api
there's a clear difference between "i dont know" and "i do not want to know"
your case is the latter
yup
for example
there's a clear difference between "i dont know" and "i do not want to know"
your case is the latter
@earnest phoenix if i dont want to know i shouldnt be asking it if u wanna help then help or go away
client.on("message", message => {
member doesnt exist here, only message exists
but you can get a member from a message by using message.member
})
client.on("guildMemberAdd", member => {
member exists here
})
what you probably want is for someone else to spoonfeed you the solution lol
because that error is easily google-able
even on google some one will answere it same happening here whats the diff (only diff we need to block ppl like you this way)
https://cdn.discordapp.com/attachments/714045415707770900/770599976170553344/unknown.png
Please help me. This is the problem.
lmao
it's not me who's the problem, it's everybody else!
@earnest phoenix ๐
I don't know where sould i put this catch block
i was mocking you but alright
don't try catch every error you encounter
fix it instead
?
@earnest phoenix
it's not me who's the problem, it's everybody else!
the error is saying that song.url doesnt exist
whatever song.url returns isn't a url
?
@earnest phoenix just block him(cry) he is not going to help
he helps more than you people think, hes one of the most knowledgeable people on this server
he helps more than you people think, hes one of the most knowledgeable people on this server
@quartz kindle well make a lot of scence with that attitude
yes i'm harsh get over it
@earnest phoenix
@quartz kindle i don't understand
.play(ytdl(song.url))
๐คท
and how can i fix it?
Serving at http://48b5189653e5:3000, http://127.0.0.1:3000, http://172.17.0.108:3000
this means??
huh
it means your server is opened and accessible in those addresses and ports
port how to use on desk.
@earnest phoenix your song doesn't have a url, it's undefined, it's up to you to find out why; console.log the objects, inspect what you pass, find out why it doesn't have a url
emm.. i try
console.log(await require('../../tools/mentions')(args[0]));
let target = message.guild.members.cache.get(await require('../../tools/mentions')(args[0]));
console.log(target);
Help me, idk why it is returning undefiened
https://media.discordapp.net/attachments/223867697312694272/770601348315611156/unknown.png
@willow mirage the member is not cached
then how i can cache ?
ok
@quartz kindle one more question
my status is editing vscode
but when i do message.member.precense it return nothing
presence, not precense
Sry, i don't understand. Now i need an other video link? or catch block???
Im so idiot
isnt .presence an object
yes it is

anyone know how to use port on chrome
what do you mean
Sry, i don't understand. Now i need an other video link? or catch block???
so?
don't catch it
find out why the song doesn't have a url
find out what object the song is
Serving at http://48b5189653e5:3000, http://127.0.0.1:3000, http://172.17.0.108:3000
how to use this
copy the url
eh
paste it in your browser
say This site canโt be reached
Where did u copy that log from?
What are even trying to do?

or permission calculator
A small calculator that generates Discord OAuth invite links
ok thanks
Unfortunately I can't help with API
Ok

if all you do is flail your arms around and cry for help, we don't know how to help you
perhaps you can... ask a question, that would help us help you!
ok i am here
key u mean ?
where can i find that ๐
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('Your top.gg token', client);
Basic connection example
Obv remove client
i see
ok i understood ๐คฃ
wait which all libraries are supported in top.gg btw
coz i dont see some other bots' server counts too
๐ค
const DBL = require('dblapi.js'); const express = require('express'); const http = require('http'); const app = express(); const server = http.createServer(app); const dbl = new DBL(yourDBLTokenHere, { webhookAuth: 'password', webhookServer: server }); dbl.webhook.on('ready', hook => { console.log(`Webhook running with path ${hook.path}`); }); dbl.webhook.on('vote', vote => { console.log(`User with ID ${vote.user} just voted!`); }); app.get('/', (req, res) => { // ... }); server.listen(5000, () => { console.log('Listening'); });
How can I use
It
How to setup
@low orbit dms
Then
Paste this code in your JS app.
yes... in your javascript code. in your bot.
What
รน
I put this code
Ctrl + P
But I have to add something like my bot api
yes... in your bot's code...
Or something
where it says 'yourDBLtoken' for example
This will create an http server in your bot, which will receive the votes when they're added.
yes
Yea I ask that
Is it English or JavaScript that you have trouble understanding? I'm not sure.
@umbral zealot what I have to put in webhook auth : password
Webhook server : server
how do i port forward my pi so that my votes can go through with the api
What I have to put there
I'm not even sure - the docs don't even say what the heck the password does
"The string for Authorization you set on the site for verification."
@umbral zealot started at the new job yet?
And I have to put that code in my main file
Auth can be set in the edit page
oh there it is.
yeah right here
so your password here must match the password you set in your bot's dbl webhook
how do i know if i got firewall block request if im on my pi
that's literally in the example, Adarsh
literally defined right above.
const DBL = require('dblapi.js');
const express = require('express');
const http = require('http');
const app = express();
const server = http.createServer(app); // <========== THE SERVER
const dbl = new DBL(yourDBLTokenHere, { webhookAuth: 'password', webhookServer: server });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running with path ${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
app.get('/', (req, res) => {
// ...
});
server.listen(5000, () => {
console.log('Listening');
});
Why do you need http and express?
Where I put that code
whats server for
In your main file would do fine
just put that code somewhere that gets loaded when u start the bot
like, the index.js file or whatever you named it
Yes. Put that code, in that file.
make a blank space and paste it in
You know, copy/pasting, most likely how you made your entire bot, it feels. >.<
Great, it's in there.

now fix the password
Ok
and... make it do what you want it to do.
... if you don't know what any of this is, why are you trying to use it
like, seriously, what are you even doing
Great, that's exactly what this does.
But I don't know how to use
That's the webhook server.
legend
So what I have to put
what do you have to put where
Server id ???????
no, that's a variable
that's defined on the line before
Seriously, please read this: <#development message>
@outer topaz you should try going for very simple stuff
as a newbie I can say I started coding my bot with the basics and understodd them after
but you have to know the LANGUAGE
Which, clearly... you don't
It's clearly you wrote your bot by just following a tutorial. You don't understand the language you're using
I only need to setup votelog
otherwise you'd know what a variable was.
it's ok to copy paste something you dont quite understand yet, but you have to know how it works at some point
you've gone too far
dont have a grasp on what you're doing
go back a few steps
it's ok to copy paste something you dont quite understand yet, but you have to know how it works at some point
@earnest phoenix I'd say the opposite of the first part. If you're copy and pasting without knowing what it does, you won't know how to improve your code in that area if something ever goes wrong (errors). Copy and pasting teaches newcomers to write in only one style, which is the issue with being new and picking a project not suitable yet.
@sudden geyser oh, well that was how i started learning tbh
of course I learned what the basic elements of python were
but discord.py caught me off guard at first
i later learned to develop my own style
but im still a noob
I started learning that way too, but I'm basing it off how I see a lot of new programmers start with a Discord bot and immediately start struggling and falling into the same pit falls thinking they won't.
I think learning to program by making a bot is a good way of learning, but to learn only through making a Discord bot and not trying out other things to test your skills is the hard part.
yos I agree
Haven't done a webhook before, but isn't it just making post requests to discord when your program finds something exciting?
For Discord webhooks sure
but webhooks are just literally a web server listening on a port with a key, it's not a Discord-exclusive concept.
Right, sounds like just an API endpoint
my bot suddenly went from 10s restart time to 2 min restart time, i don't think i did anything to cause that but what are some things i should look at?
debug logs
oh a reverse api. Got it
if it's some process that's taking a very long time for some reason (db connection)
probs sound dumb but how do i setup debug logs
i don't have a button for that on my panel
if that's what you mean
wdym button
are we talking about a logger?
I mode one here a while ago.
You could probably do a similar thing, but have it dump to a file at some interval
#development message
My bot works when I type from dm, but it doesn't work when I use commands on servers and I can't solve it. What should I do?
You find and change the logic error in your code
Just wondering, but why bother making ILogger an interface? Are you implementing it somewhere else as well?
i just want to get information of whatever processes are taking forever
Listen for the debug event in Discord.js: js <Client>.on("debug", console.log);
Just wondering, but why bother making
ILoggeran interface? Are you implementing it somewhere else as well?
@sudden geyser In this instance it's a console logger. With this design approach, I could have it logging to a webhook, or some webservice
See if anything meaningful is there.
thanks!
Auger so you're implementing ILogger elsewhere as well?
Auger so you're implementing
ILoggerelsewhere as well?
@sudden geyser I could be. This is just how I write code
I try to adhere to at least some design pattern that is maintainable
Specifically that link is just something i wrote from scratch in Discord. It isn't in any project, but similar to what I usually write
eh that's fine. I think it adds extra boilerplate if it's just added without any actual plan on using the interface elsewhere, but it's a design pattern after all.
ILogger in general being an interface
Well, if it wasn't an interface I might as well be writing new Logger() whenever I wanted an instance
Even the factory design won't save me from that, unless I used var I suppose
but to your point, this is blantant overengineering of a logger lol
It's mostly for practicing SOLID design principles I learned during my co-op
Correct me if I'm wrong, since I don't write C# but the OO design approach is very similar to Java. Why would you need to create a new logger every time? The ILogger interface only sets two requirements: void Log(string msg) and void Log(Exception e). This doesn't have anything to do with factories. In languages like Swift, making a value compute lazily would be the solution to only having one instance (sort of), but it wasn't thread safe (as a note).
Right, lazy approach also works. Or having a static instance even
The benefit of using an interface is so that I won't have to refactor everywhere I reference Logger as the concrete datatype when I change logger contexts
So imagine I want to completely change where my logger logs to
Instead of refactoring everywhere it's referenced, I can just inherit the interface that guarantees it will have the same methods and parameters
so they are essentially interchangeable
@sudden geyser can i send you my debug?
So for instance the refactor would just become the new implementation and changing the factory like so:
static class Factory
{
//ILogger GetLogger() => new Logger();
//ILogger GetLogger(Type type) => new Logger(type);
ILogger GetLogger() => new BetterLogger();
ILogger GetLogger(Type type) => new BetterLogger(type);
}
...
interface ILogger
{
void Log(string msg);
void Log(Exception e);
}
...
class BetterLogger: ILogger
{
string name = "NA";
BetterLogger() {}
BetterLogger(Type type) { _type = type.Name; }
void Log(string msg) => Pushbullet.SendMessageAsync($"[{DateTime.Now}] ({name}) - {msg}").Wait();
void Log(Exception e) => Log($"Error! Exception: {e.Message}");
}
And because my code references the interface like ILogger _logger = Factory.GetLogger() No refactor is needed
[WS => Manager] Failed to fetch all members before ready! Error [GUILD_MEMBERS_TIMEOUT]: Members didn't arrive in time.```
If the plan is to have more than one logger and it needs to implement some base requirements, then by all means, ILogger is a perfect use case. I already considered that when I first saw your approach. I just think if you're doing it for the sole purpose of "there's the chance I need more than one logger with the same requirements", it can add some boilerplate code filling in requirements then there's no actual plan on requiring multiple classes implement an interface.
And if you do want to refactor your code but don't need more than one class that implements said interface, then refactoring the old class you have is probably suitable.
i have fetchAllMembers true and got 46 users cached in 548 guilds
hmm
@sudden geyser Well I typically have a logger similar to that in a .NET Standard Class Library
use a bin
you must have the guild members intent enabled on the bot settings page @uncut river
then you cant fetch members
Then you can't try getting members from gateway
contact support and request for it then
why? i don't need it
bruh
i haven't needed it
But you're asking for it?
i never asked for it what?
because the setting wasnt applied
it was never applied at any point
i'm quite confused because i didn't think i needed it
well, you do
ah, caching
do you want to fix the issue or not
then do the intent fucker thing
then remove fetchAllMembers and keep your 46 users
you need the intent to fetch the guild member list
do all large bots have server members intent?
of course
dude all bots period
unless they don't need it
i didn't realize i needed it my bad
most original bots don't 
cough non caching lib cough
i thought fetchAllMembers was good enough
it was
so now my bot dead until they respond right?
cuz it just spam
Failed to fetch all members: Error [GUILD_MEMBERS_TIMEOUT]: Members didn't arrive in time.
Error [GUILD_MEMBERS_TIMEOUT]: Members didn't arrive in time.
then fetch member in message.js?
what lib are you using
discord.js lmao
Hello i have a question in js, can i pos tit here ?
asdasdasdasdasdasdasdasdasdasdasdasdasdasd
Hello i have a question in js, can i pos tit here ?
ask away
ok good
then uh
turn off caching
for?
everything
even guilds?
except
So my guild.owner is working on one sevrer but on another it return null
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'name'***
Wtf
Wait
Sending code too
async def userinfo(ctx, member: discord.Member = None):
member = ctx.author if not member else member
roles = [role for role in member.roles]
embed = discord.Embed(title = f"{member.name}'s Userinfo!" , colour = member.colour , timestamp = ctx.message.created_at)
embed.set_thumbnail(url = member.avatar_url)
embed.set_footer(text = f"Requested by {ctx.author.name}" , icon_url = ctx.author.avatar_url)
embed.add_field(name = f"**Name**" , value = f"{member.name}#{member.discriminator}" , inline = True)
embed.add_field(name = "Id" , value = f"{member.id}")
embed.add_field(name = f"**Nickname**" , value = f" {member.display_name}")
embed.add_field(name = "**Status**" , value = f"{member.status}")
embed.add_field(name = "**Rich Presence**" , value = f"{member.activity.name}")
embed.add_field(name = "**Account Created On**" , value = member.created_at.strftime("%a, %d %B %Y , %I %M %p UTC"))
embed.add_field(name = '**Joined This Server On**' , value = member.joined_at.strftime("%a, %d %B %Y , %I %M %p UTC"))
embed.add_field(name = "**Roles**" , value = f" ".join([role.mention for role in roles]))
embed.add_field(name = "Bot?" , value = member.bot)
await ctx.send(embed=embed)```
@earnest phoenix owners are not guaranteed to be cached
Btw what's the meaning of that error?
Hey, my bot used to moderate over 170k members and suddenly got errors making it moderate 20 members only, but the server count stayed the same. Any reasons due to this?
intents
I asked the hosting support, they got nothing to do with it and it may be from discord
intents
@pure lion Ahh I see, server member intents are ON for me?
its meant to be an array of strings according to the docs
so i have created a cloudflare worker type thing in C++ with V8, what do you guys think about making a discord bot that is entirely created with a panel so people can create tiny little scripts and enable them to run as commands on your discord server
you just invite it and write some small JS code to do some discord things
that could be heavily exploited
well, userscripting is basically fixed now
each V8 is in its own process in a pool to avoid OOM and it communicates seperate from main program
what if someone does if (process) client.destroy()
ah
imPoRt
not a thing either
can we fork bomb it
i rewrote require as a psuedorequire to include pre-generated js object binds from native code
its native-code to prevent people from per-se. Changing the access a command has and doing stuff to another guild id

Sounds like you need a pentester to check that security tbh
i have a few from switchblade team 
one weird thing that i someone dislike is that V8 uses globals and its kinda designed to just kill the process whenever one V8 isolate goes OOM
so each isolate needs to spawn up a new process and do some IPC stuff
which is not too much of an issue on linux and its just a few milliseconds, doesnt really matter since the thing will be in docker anyway

hello world saves and runs in 5ms after you press the exec button still
i also rewrote fetch in C++ for v8 binds for some reason
.
selfbot, ban this guy
:o selfbot
is it easy to switch from .json to mongodb
It depends on how you've set up your bot.
Are you directly writing to the database/file, or do you have it backed by some class/API.
if youve set it up with json
discord.js
im using .json rn
every 3 days
the .json
turns from like 57 GB
to
corrupts
0 bytes
holy fuck
?
holy fucking shittt
its fine
thats a big fucking file
it wont be 57 GB anymore
you are going to switch
okay so
no buts
What the fuxk
lmfao
How the hell did you manage to create 57gb json
but u can have multiple in mongodb too, right?
@pure lion
i can make disabled.json go in a disabled database
etc
Mongodb is a full database system, it doesnt store in files directly
tim can i do this one
Sure gi ahead
yay
lmfao
austin
where do you host
@indigo flax
oh hes offlne
tell me where you host when youre back ajjjjjjjjjjjjjjjjjjjjjjj
:KM_Dorime: so i have created a cloudflare worker type thing in C++ with V8, what do you guys think about making a discord bot that is entirely created with a panel so people can create tiny little scripts and enable them to run as commands on your discord server
@zinc condor so whats the point of it?
something somwthiwjgdsgjbsd
bot prototyping is pretty easy for discord
people just invite it to their server to write simple scripts to do stuff like check channels or whatever. I can make a scratch like interface for it too for people who dont know about it
i host it on my own hosting company
Okay
you dont need to host the bot
What OS?
you just invite it and it just does shit for you
linux
pretty sure such bots already exist though
Which distro?
Deb or Ubuntu
i mean scratch like
i think deb
Is it a vps that you ssh into?
well where else would you host a bot
Pterodactyl
yes
a bot hosting service is shady af
Oh god
yea
And create an acc and then a new cluster thingy
ik
The free one is more than enough
i signed up
schemas are quite dumb for mongo imo
Mongoose uwu
its meant to be flexible
cluster is being made
Okay epic
should i whitelist IP
Get the connection string and whitelist 0.0.0.0
i create a database user?
Yeah
done
Has anyone used motor for async mongodb in Python?
where
I never used Motor
:(
cluster is still being created
Okay just waut
just raw mongodb is good enough for python? @hollow sedge
if it adds another data to my storage.json
my bot goes offline
it says like
JS: File too big to handle
idk
just raw mongodb is good enough for python? @hollow sedge
@fluid basin ? what does that mean?
omething like that
wait that wasn't a meme
why use motor and not pymongo
alright thanks
storage.json is actually what you're using for a database?
yes..
That's you're issue
dont bully me, i made this bad like 3 months ago
why use motor and not pymongo
@fluid basin idk i was just wondering if it would be worth switching to motor



