#development
1 messages · Page 1052 of 1
gn
Bye! 👋
bye o/
its funny that i still use this
i have that on my bookmarks cuz i keep forgetting es6 syntax
huh?
I’vr never used export import before
its a tad better
pesky v
ok
the good thing about import is that you can import them as
instead of using unecesssary vars
Alright gn all! 👋
import {a as Something} from 'lib';```
as of
```js
const a = require('lib');
const Something = a
the file i want to export the function is in a diff folder.
so
would it still be lib
or would it be commands/lib
nto necessarily
ok
the function you want to import needs to be on a different file (thats the reason why you'd want to import)
being in the same folder or not doesnt matter
that thing i sent you is already for dummies
this is what you should be reading for an in-depth

do i define lib
lol
my file name isnt lib
do i change from lib
or is that like a server the data goes through?
lib is just a foo name
ok
you can do default for individual or multiple exports
which the best part is that you dont need to specify each individually
ok
export function mock(){
message.delete()
const mockword = message.content.slice(8)
message.channel.send(mockword)
}
import mock from 'lib';
so
that would mock?
lemme try
this is so confusing
you know scopes?
imagine this
let a = 1
function foo() {
let b = 2
}
console.log(a + b);
what would happen here?
console would log 1
nah, it'd say 1, undefined
^^
wouldn't it?
indeed
see i was technically right
but thats beyond the point
i said 1
yea
reason is, b is not defined in that scope
okkkkkkkkkkkkk
same goes for message
because its an export im pretty sure it wouldnt load message unless you pass it onto the function
i could try rq, i always pass them out
yes it was
i know that
Anyone knows Pascal here?
rule 7 has entered the chat
ik
yolo
im just gonna put functions at the end of my code
insted of having them in dif files
my code is a mess
the fact that my index is 240 lines long is concerning, it could be shrank down to 100 i'd say
mine is 245
not too bad
my index on this bot used to be over 870, i managed to shrink it to 300 then kept optimizing from there
and it was 870 even with my command n shit outside of it
1-67 dependencies and startup
68-210 - discord events
211-226 - IPC events
226 - 238- eval
which bot
how do i set text inside of .setFooter() to a link
its only txt if i recall
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
i think its only text mah dude
i figured
var https = require('https');
var url = `https://www.reddit.com/r/memes/hot/.json?limit=100`
https.get(url, (result) => {
var body = ''
result.on('data', (chunk) => {body += chunk})
result.on('end', () => {
var index = JSON.parse(body).data.children[Math.floor(Math.random() * 100) + 1].data
var embed = new Discord.MessageEmbed()
.setTitle(index.subreddit_name_prefixed)
.setImage(index.preview.images[0].source.url.replace('&', '&'))
.setColor(color)
.setDescription(`[${index.title}](${'https://reddit.com' + index.permalink})`)
.setURL(`https://reddit.com/${index.subreddit_name_prefixed}`)
message.channel.send(embed)
})
})
break;```
my friends said this code was unsafe
uh
can someone explain to me whats unsafe about it
Y’all have your events in your index.js?
Can someone explain
what index is
data = await Promise.all(data.map(async (data, index) => {
const user = await client.users.fetch(data.key.split("-")[2]).catch(() => null)
if(user) {
return {
tag: user.tag,
level: data.value.level,
rank: index + 1
}
}
}))```
Y’all have your events in your index.js?
@earnest phoenix no i just use an event handler
index of the current element
*-1
and will that have any other effects or just negative it
no, no other effects
¯_(ツ)_/¯
you using js for that? looks like unity project
it's using webgl and js
ah i see
it'd be nice if it actually had a purpose, like making a 2d top down world. for now though that's it lol
You don't need that *-1 btw, just prefix the number/variable with -
i was thinking of rendering a map for a future project
but that'd be kinda advanced for what im currently working with
const commandFiles = fs.readdirSync('./allCommands/classic/').filter(file => file.endsWith('.js'));
why isn't this working? allCommands and classic are both folders
it worked when i didn't have classic folder but i wanted to have folder for each category
please ping me
What I want to do is create folders for category instead of putting all files in one folder. That's easy alone, but it's hard to use the same method of module exports and fs.readdirSync
Need some help in regards to making an embed when the bot first starts.
well i am no programmer but i think i can answer basic questions
don't ask to ask, just send your question
Every time my bot sends out message is not defined~
show code
2 secs
is there some error @stark abyss
bot.on('ready', () => {
console.log('bot is on!');
const embed0 = new Discord.MessageEmbed()
.setTitle ('TryBot')
.setDescription(':TryGTick: The shard just respawned !')
.setAuthor('TryBot Status')
.setThumbnail('https://i.gyazo.com/da90040b7acd59427216c9f6a01471ff.jpg')
.setColor('#9700FF')
.setURL('https://i.gyazo.com/da90040b7acd59427216c9f6a01471ff.jpg')
.addField('Shard 0', 'Shard Status \`Online\`', true)
.setTimestamp()
.setFooter('Thanks for using TryBot!')
message.channel.send(embed0);
bot.channels.cache.get('730940552333492375').send(embed0);
bot.user.setActivity(">commands")```
message.channel.send(embed0);
^
this si causing the problem; message isnt defined
thats correct
and how do i do that?
well oopled do you have any idea in terms of how to use multiple folders to do this
const commandFiles = fs.readdirSync('.allCommands/classic/').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(.allCommands/classic/${file});
client.commands.set(command.name, command);
}
because i had one folder all files in it and it worked beautifully but i have too many files to add and i have more folder for each category
first of all, why are you trying to send messages in the ready event
To show that the bot is online and ready
you can just console.log('ready')
he is probably tryna make a channel to show status of the bot
^
oh, so you have a specific channel you want to log status to?
yes
so
don't ask to ask just ask
Yes its specified
okay sorry
i see
music bot yes
yes lol
you need the ID of your status channel
I have that
and i have a probleme with a specify command
query_string = urllib.parse.urlencode({"search_query" : input()})
html_content = urllib.request.urlopen("http://www.youtube.com/results?" + query_string)
search_results = re.findall(r'href="/watch?v=(.{11})', html_content.read().decode())
print("http://www.youtube.com/watch?v=" + search_results[0])
bot.channels.resolve('id here') will return a textchannel object representing your status channel
which port should i use for my webhook url?
And where will that need to go?
bot.channels.resolve('id here')will return a textchannel object representing your status channel
@sonic lodge i didint understand
you can use it like this
var embed = ... // you define your embed here
var statusChannel = bot.channels.resolve('channel id here');
statusChannel.send(embed);
Sure
ah yes sorryt
html_content = urllib.request.urlopen("http://www.youtube.com/results?" + query_string)
search_results = re.findall(r'href=\"\/watch\?v=(.{11})', html_content.read().decode())
print("http://www.youtube.com/watch?v=" + search_results[0])```
What's that code snippet supposed to do
I'd suggest moving to aiohttp completely, urllib is blocking
.... kind of
now its reading status is not defined
bot.on('ready', () => {
console.log('bot is on!');
var embed4 = new Discord.MessageEmbed()
.setTitle ('TryBot')
.setDescription(':TryGTick: The shard just respawned !')
.setAuthor('TryBot Status')
.setThumbnail('https://i.gyazo.com/da90040b7acd59427216c9f6a01471ff.jpg')
.setColor('#9700FF')
.setURL('https://i.gyazo.com/da90040b7acd59427216c9f6a01471ff.jpg')
.addField('Shard 0', 'Shard Status \`Online\`', true)
.setTimestamp()
.setFooter('Thanks for using TryBot!')
var statusChannel = bot.channels.resolve('730940552333492375');
status.channel.send(embed4);
bot.user.setActivity(">commands")
status.channel.send(embed4)
in search_results i think
oh
What's the error, RedArms
statusChannel, not status.channel
What's the error, RedArms
@slender thistle IndexError: list index out of range
Nice
search_results is an empty list
and you're doing search_results[0] trying to access the first element
@slender thistle i didint understand
print(search_results)
output: []
to access a first element of a list, there needs to be one
>>> my_list = ["first", "second", "third"]
>>> my_list[0]
'first'
but the script search youtbe link from keyword
ahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
okayyyyyyyyy
lol
re.findall return a list
And sometimes it can return an empty list
so basically what you get is
search_results = []
search_results[0]```
which is equivalent of ```py
my_list = []
my_list[0]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: list index out of range
but why the list is empty ?
Because nothing was found for the query
for (const file of commandFiles) {
const command = require(./classic/${file}), require(./gambling/${file});
client.commands.set(command.name, command);
}
well ofc this is wrong, but how can i have it require 1+ folders in that const command?
bruh why is no one helping me
@slender thistle don't get mad at me for pinging if you wanna help, help else ignore
i am frustrated 
(I don't JS, sorry)
why notreaddirSync?
@slender thistle you have a solution ?
@stark abyss
@slender thistle i cheked the list is empty but how to resolve it
if search_results:
video found
else:
video not found
yo shivaco, while you're here, which lib have you made?
but why they are not video found
dblpy
top gg dead
The managed role?
yeah, when a bot joins it autocreates a role for it, though im unsure if its discord doing that or the lib
Discord
hmmm thats a shame
@opal plank mind explaining it in a simpler way
A managed role is a role created automatically by Discord
@stark abyss read the dirs inside a folder

hence you can't delete it yourself
hmmm i see
ty
@stark abyss folder/category/commands
if you read folder you can loop em
@opal plank that’s what I am doing...? I am tryna use two folders in one const or other easier way
Oh
Well what do I do use for loop
for (category in folder) do require
What’s the difference between support and help
not support for HERE, support for MY stuff
Oh I get it
also your question might be someone elses question too, might aswell keep it here
You’ll take help but won’t help basically lmao
Ok
Well I just got off laptop so I’ll try tomorrow can I ping u then for help?
hmm
usually the gist is: ask and wait until someone awsners, i usually stay here quite constantly, if im here i'll help, but someone might come first
Ok
anyone know's how to make a discord bot website dashboard?
Gotta learn some react/html/python/java whatever
There are more options out there
But you'll need to learn some web programming that's for sure
I'd say react is the easiest to hop in, but that's my opinion
Heyo!
How do I have my bot create a channel on a command (Not !createchannel)
Example: z!logs I have created a channel named #logs
Hi
Can someone help me with discord.py, my custom prefix command isn't working and I dont know why
What problem
like the code?
The file that contains the prefixes
prefixes.json
There you go
>>> import json
>>> json.loads("")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\ezboo_000\AppData\Local\Programs\Python\Python38\lib\json\__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "C:\Users\ezboo_000\AppData\Local\Programs\Python\Python38\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\ezboo_000\AppData\Local\Programs\Python\Python38\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
you are not handling the error
with open('prefixes.json', 'r') as f:
prefixes=json.load(f)
in get_prefix errors out
aka an exception is thrown
You are not try-excepting it
thats because that wont always produce an error
when the file is correct json that wouldnt error
import discord
import json
import random
from discord.ext import commands
def get_prefix(bot, message):
if not message.guild:
return commands.when_mentioned_or("!")(bot, message)
with open('prefixes.json', 'r') as f:
prefixes=json.load(f)
if str(message.guild.id) not in prefixes:
return commands.when_mentioned_or("!")(bot, message)
prefix=prefixes[str(message.guild.id)]
return commands.when_mentioned_or(prefix)(bot, message)
client = commands.Bot(command_prefix=[get_prefix, ‘n!’])
startup_extensions = ['cogs.prefix','cogs.corona']
@client.event
async def on_guild_join(guild):
chane = [x for x in guild.text_channels if x.permissions_for(guild.me).send_messages][0]
await chane.send('Thanks for adding me!')
with open('prefixes.json', 'r') as f:
prefixes=json.load(f)
prefixes[str(guild.id)] = "!"
with open('prefixes.json', 'w') as f:
json.dump(prefixes, f, indent=4)
@client.event
async def on_guild_remove(guild):
with open('prefixes.json', 'r') as f:
prefixes=json.load(f)
prefixes.pop(str(guild.id))
with open('prefixes.json', 'w') as f:
json.dump(prefixes, f, indent=4)
@client.event
async def on_ready():
servers = "{:,}".format(len(client.guilds))
print('Successfully logged into {0.user} with an ID of {0.user.id}'.format(client))
await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name=f"{servers} servers | n!prefix"))
if __name__ == "__main__": # When script is loaded, this will run
client.remove_command("help")
for extension in startup_extensions:
try:
client.load_extension(extension) # Loads cogs successfully
except Exception as e:
exc = '{}: {}'.format(type(e).__name__, e)
print('Failed to load extension {}\n{}'.format(extension, exc)) # Failed to load cog, with```
this was my old code and it worked
so it's not try/except.
Was that when your file actually had a proper JSON syntax
as I said, it wont always error
Shivaco what
You are trying to convert a file with NO CONTENT into a JSON
The point of a try/except is to catch the error if there is one, which is not guaranteed
let's see
Then you wouldn't get a JSONDecode error would you?
Nothing is suppose to be in the json
beside {}
and I put {} in it
then it does the rest
get_prefix is called from on_message
and the error is happening on line 11
which happens to be prefixes=json.load(f)
Could you please start using single messages for your questions
O
easiest way is to store a dictionary of user id's to timestamps of when the time they can use the command again
then when they use the command, check if it exists and the timestamp is less than what's stored if it is, tell them to wait. Otherwise run the command and update the entry or insert it
Wtf am i doing wrong
you guys are not understanding that the code
was 100% working
3 hours ago
and 3 hours ago you had proper json
so the error isn't in the code...
ALL I HAD IN THE JSON WAS {}
what more is there to it
you wouldnt get a JSONDecode error if your json was proper
And you're getting very mad, so just calm down real quick
I'm not mad
getting angry doesnt help you solve an issue
And I'm saying, unless there's a bug with python with json, which I doubt, your json is wrong
Your bot probably wipes/wiped the entire file when you close/closed it
whether you can accept that fact or not
how do i fix it then
you could start with adding a try/except as advised
Write to the file in a background task, don't open it in w mode each time an event happens
you open the file per each message sent
And the error is loading an empty string
sorry if I ask, but what is the script (JavaScript) to join the bot in vocal?
https://discordapp.com/channels/264445053596991498/272764566411149314/732093414765756497 this is what I mean. The file becomes empty at some point and the bot tries to convert an empty string into JSON
sorry for the inconvenience
while True:
with open(file, "w") as f:
f.write(f"{i} = {i}")```
file is empty when I open it while that code snippet is running

Hello i need help I added a features a new features that require new permission so i changed the invite link but what should I do for the old servers ?
There's nothing wrong with the file itself. Your overall system of opening and writing to the file is just... not exactly well written
shivaco
but that's not the issue it can't be
if it was working earlier
I just rolled my code back
hmm
Hello Admin, I need some advice relating to bot for my channel. Can you tell me please how can I get it? Thanks.
how to add a random command
so peron can choose
i mean bot can choose from 1 to 10 a random no
and send it
it has default export and should work
oh lul
i forgot to compile ts nvm
@delicate shore math random
How do I get the bot to ask questions in order
await
What is your sample bot name? it will ask
It will ask my last name after writing my name
and will delete previous questions
yes i don't know how to use it
can you give an example ?
@slender thistle the discord.py API was having issues that's why It wasn't working
not discord.py but the DISCORD api.. idk actually but some API was the reason my bot wasn't working
because its working now
my friend was having same issues
so probs api
or vps idk
it was something 😂
thanks ❤️
oh well whatever
good news is it works
guys, on the edit bot page, in the webhook url input should I put the url generated by the webhook that I created on discord?
@slender thistle
@client.event
async def on_guild_remove(guild):
await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name=f"{servers} servers | n!prefix"))
with open('prefixes.json', 'r') as f:
prefixes=json.load(f)
prefixes.pop(str(guild.id))
with open('prefixes.json', 'w') as f:
json.dump(prefixes, f, indent=4)```
is this the right way to be popping it out of the json
Not exactly but... it should work
I'd suggest a caching system for prefixes though
I restart my bot and now messages are doubling up, i only have 2 bots running no VS is open ive changed token no luck... can someone help me find the error cause i havent edited anything for it todo so..
so only 1 instance of the bot is running?
did you use d.js? if yes did you pass the token to the Client constructor and have client.login() defined?
if yes remove client.login()
discord.js yes and yes i have client.login()
if i use my aliases it doesnt double up if i use the raw code it does
eg !wrk = 1 message
!work = double message
did you pass your token to the client constructor too? const client = New Client({TOKEN: YOURTOKEN})
._.
yeah
then remove client.login() other wise you get 2 Clients running
ive got
const bot = new Discord.Client();
const config = require('./config.json');
bot.config = config;
Then the login at the bottom
ok then client.login is correct
i have the token in my client sorry misunderstood
maybe there is something wrong with your command handler
@delicate shore math random
@restive pebble i did but
yeh well i was stuck on the command handler for almost a month now that ive cleaned it up it worked for 1 day now double ups...
wtf
the entire life of a programmer in one word
would u mind taking a look for me @lusty quest ?
post your handler here
?
wot
@lusty quest what happens when i do npm unpublish
idk
does it remove the whole package?
@eternal oriole you load your command twice
@eternal oriole line 53 and 55
I think it removes the latest version published, lemme check
i never puplished any NPM package. so i cant tell you im not Tim
fs.readdir("./commands/", (_err, files) => {
files.forEach((file) => {
if (!file.endsWith(".js")) return;
let props = require(`./commands/${file}`);
let commandName = file.split(".")[0];
bot.commands.set(props.help.name, props);
props.help.aliases.forEach(alias => {
bot.aliases.set(alias, props.help.name);
console.log(`👌 Command loaded: ${commandName}`);
})
``` @lusty quest hense why i was stuck on this for a month. its still doubling..
hmm looks fine for me. are you sure your updated the code properly (uploaded to your server if the bot is running there)?
fs.readdir("./commands", (err, files) => {
if (err) return console.log(err)
let file = files.filter(f => f.split('.').pop() === "js")
file.forEach(f => {
let prop = require(`../commands/${f}`)
bot.commands.set(prop.command.name, prop)
if (prop.command.aliases) {
prop.command.aliases.forEach(a => {
bot.aliases.set(a, prop.command.name)
})
}
})
})
``` i used this handler for a while and i had no duplicates.
i trying to make it to show the role name but i shows this instead <@&720997710819360913>
code:
const newMemberRoles = newMember.roles.cache.map(role => role.toString());
const oldMemberRoles = oldMember.roles.cache.map(role => role.toString());
newMemberRoles.forEach(async (p) =>{
if(!oldMemberRoles.includes(p)) {
logchannel.send(
`\`[${moment(newMember.createdTimestamp).format('HH:mm:ss')}]\` ✏️ **${oldMember.user.username}**#${oldMember.user.discriminator} (ID: ${oldMember.user.id})was given the \`${p}\` role.\n\`[Time]\` ${moment(newMember.createdTimestamp).format('dddd, MMMM Do YYYY, h:mm:ss a')}`,
);
}
else{
return;
}
});```
you only display the role object (p). This defaults to the mention in the chat, if you want the name you need to add .name i think
bot.commands = new Discord.Collection();
bot.aliases = new Discord.Collection();
//Read Commands Folders//
fs.readdir("./commands/", (err, files) => {
if(err) console.log(err);
let jsfile = files.filter(f => f.split(".").pop() === "js")
if(jsfile.length <= 0){
console.log("Couldnt find any commands");
return;
}
jsfile.forEach((f) => {
let props = require(`./commands/${f}`);
console.log(`${f} loaded!`);
bot.commands.set(props.help.name, props);
props.help.aliases.forEach(alias => {
bot.aliases.set(alias, props.help.name);
})
})
})
i mean this works but doesnt use my aliases i use
module.exports.help = {
name: 'ping',
description: "status of bot!",
aliases: ["p", "status"]
}
@lusty quest i have tried to add .name and .id, both of them comes out undefined
anyone who uses a postgresql database here?
my when i check for my postgresql ports using netstats its only open in tcp6 not in tcp
@lusty spade look in the docs what you can use
docs is currently down
How long does it usually take to get your bot officially verified by Discord? It says 5 business days — but I have been waiting 11 days and still no response.
@clever vector database
@earnest phoenix they have no guaranteed turnaround time but you should expect somewhere between 1-3 weeks
@golden condor
Sorry I don't know who you are
@earnest phoenix they have no guaranteed turnaround time but you should expect somewhere between 1-3 weeks
@golden condor thanks bro
Np
@golden condor You know the bot that we do in Glitch.com?
like rini
or maybe something
No I don't
because i am checking my email every hour to check if discord responded xd
Please stop pinging me, I don't remember everyone who I helped
Or everything they did
I don't use glitch
Not anymore
Why
Can you please keep this conversation outside of here
This is development
Keep this channel on topic
my when i check for my postgresql ports using netstats its only open in tcp6 not in tcp
any solution?
mk so i need help with bootstrap
and it looks flat generally, as it's supposed to be
but as soon as it sees a message zoom
and to be clear, i dont need any caching like at all so yeah
this was after a theory i had on what was causing memory to "leak" and ive singled it out on the library, so would anyone happen to know a solution to this
Try using intents @valid frigate
hello
ok so basically all i really need is listening for messages
anyone free to help me with something?
so i set these two intents
if member:hasPermission(0x00000004) or member:hasPermission(0x00000008) then
local mentioned = message.mentionedUsers
if #mentioned == 1 then
message:delete()
message:reply("The ban hammer has come, and it has chose to land on <@!"..mentioned[1][1]..">!")
member.guild:banUser(mentioned[1][1])
end
if #mentioned > 1 then
message:delete()
message:reply("You can only ban 1 person at a time you bot!")
end
if #mentioned < 1 then
message:reply("Try to mention someone next time so that i can ban them!")
end
else
message:reply("<@!"..memberid.."> you dont have the permissions required to ban people, you noob!")
end
end```
how do i make it actually delete the messages of the one that is getting banned?
You could just use an array
what intents are necessary for just messages
i thought intents was a bitfield?
or message partials
No you can do an array of them
that's besides the point
dont care about dms
actually ive been concerned about how djs caches members
cuz once the bot receives a message i inspected the process and saw that the members object on the heap didnt decrease in size at all
so it just constantly adds new members
You could sweep the cache on routine?
I'm not sure about that
okay i'm gonna try clearing the cache on an interval via UserManager.cache.clear()
lmao moving client to global scope moment
Guys
I wanna make my bot do a command
Like if someone does
s!nuke
The bot deletes the channel and create a clone channel with same name and same perms
<TextChannel>#clone
Wot
if(command === "nuke"){
If(!msg.author.hasPermission("ADMINISTRATOR")) return msg.reply("You don't have perms")
<TextChannel>#clome
}```
Dude
You don't literally put that
I have to get channel ID
Channel name
No
How to stop a bot? HELP ME
@earnest phoenix
https://media.tenor.com/images/1439be51ee0ecab2833877e1589419a0/tenor.gif
message.channel.clone()
message.channel.delete()```
How to stop a bot? HELP ME
@earnest phoenix CAN YOU GIVE US MORE INFO THAN THAT
^
Can you please look at the docs
^
@delicate shore if you agree I suggest you go look at them.
Just straight up yeet the code
@delicate shore if you agree I suggest you go look at them.
@golden condor
What is the function called so I can see docs
Smh
await
It's so clearly documented you can just do it
my postgresql has auto disabled ipv4 and is only accepting ipv6 help
Oo
There I've done half the work for you
Thanks
Now just click the link, and scroll down, that's pretty easy isn't it?
No
Or you can press the big button that says awaitMessages
how do i make it delete the messages of the member that is being banned, i have searched far and wide in the wiki (discordia btw)
And magically you get redirected to the docs for it
@jaunty junco it should do that automatically if you don't pass any options
problem is it doesnt
Lemme check the docs
i tried a lot of times with everything related to deleting a message and it doesnt work
How does one make a queue command
by not making it
@jaunty junco the banUser method works like this (it says on the docs)
guild:banUser(id, reason, days) days being the amount of days to delete the messages from, the max being 7
Np
so what do i do with it?
member.guild:banUser(mentioned[1][1], nil, 7) ?
like that?
You do id, the reason they were banned, how many days of messages to delete for
Yes
oh kk
That's correct
thanks will try it
Np
I ping for a help
<ClientUser>#setPresence
@golden condor thank you so so much it works! can you like link me the docs or smthn?
@jaunty junco sure
wait this is not js?
ty
hmm lua. long time havent we met
@lusty quest nah we talking about Lua. I've never used Discordia or Lua for that matter but I know how to read docs lol.
module.exports = {
name: 'roll',
description: "this is a dice command. it generates random numbers from 1-x or by default, 6. .",
execute(message){
const roll = args[0]
if (roll){
message.channel.send( ":game_die:" + "|" + message.author.username + " rolled a " + "**" + Math.floor(Math.random() * (roll- 1 + 1) + 1) + "**")
}
if (!roll){
message.channel.send( ":game_die:" + "|" + message.author.username + " rolled a " + "**" + Math.floor(Math.random() * (6- 1 + 1) + 1) + "**")
}
}
}
``` am i doing it correctly?
this is redundant
can i host my website on visual studio code
VSC is just a text editor
but you can host it on your machine tho, if you prot forward it
lol, first you learn basic javascript and node.js
@earnest phoenix ctrl c or process.exit()
or that
hey sorry to bother but i got another error
TypeError: db.updateText is not a function
https://pastebin.com/DVWj39ax
ik i fixed it tho got another error F
Can you send a sample code for the message collector
pls ticket me
@earnest phoenix adding on to what Callum said there is also <client>.destroy()
@rigid maple no
@rigid maple write it yourself
ı can't
then go learn js and read the docs @rigid maple
it spams null for some reason
but then says i reviewed it
and same in reviews command
tho it says no one has reviewed even tho i did
then learn the basic fundamentals of the language your using and make sure to actually learn js instead of trying to throw it together, with coding comes a responsibility cuz if it breaks ur gonna needa fix it @rigid maple
^
learning the basics will help alot trust me
np
why have you done msg but defined message
dont use msg when message is defined
^
o you beat me too it
lol
Alright
either define msg or change em all to message
Guys I feel that I have learned much on coding
changed all to message
alright
and when i did that i got message.includes is not a function
Yeah if u want a permssion for a command its gonna be msg statement / event. @indigo cloud
Sorry cant spoonfeed tho
never said i wanted to be spoon feeded lmao
What does message.includes signify
I can check ur codes
i am trying to get help to fix my errors
I can fix ur errors
What does message.includes signify
@slender thistle it means, its get an extra thing
Like OBS!
or smth
Did you mean message.content.includes
when i changed all from msg to message i got message.includes is not a function
Checking it now
Did you mean message.content.includes
@slender thistle yeah srry wrong, its not an function
when i changed all from msg to message i got message.includes is not a function
@indigo cloud aight so what err u get?
errors
in console i dont get any errors tho i get this
message.content.includes @indigo cloud
Ah sorry dude cant help u
its all good
when i changed all u to messages now i get message.trim is not a function
GG's
when i changed all u to messages now i get message.trim is not a function
@indigo cloud wait u mean like u do the command and it work, but if u like type smth random its reapets?
repeats
message = message.trim()```
i changed it all to message bc u guys recommended me that
Ah then I cant help but I hope u get helped Im very srry
All good 🙂
All good 🙂
@indigo cloud Anyways do u have a mute command for discord.js?
yea
Kinda stuck there
i do have one
Ohh can u help me
sure
Wait do u have a duration on it and reason?
is it timed or no timed mute command?
yes mines is timed to
sure
I tryed like all commands but no work :/
Dm?
-checkdms
Please watch the following video. Replace any instances of twitter with discord. https://www.youtube.com/watch?v=umxmHpUPS5A
can i use animated emojis in my bot even if i dont have nitro?
<a:emojiname:emojiid>
so i can?
yup
yes
ok thats great
bots have a weird kind of nitro
xD
bottro
lmao yeah
imagine if bots could boost servers
how do i get the id of a animated emoji without nitro?
if you don't have manage emojis perm you can use inspect element from the dev console (ctrl+shift+i)
try copying it’s id
how do i even see its id
If you have manage emoji permissions, go to the server settings and copy it from there, otherwise use inspect element
my postgressql is only listening on ipv6 i.r tcp6 not tcp/ipv4 help plz
Hello guys
how can i make my link
like support server link
but it just show a blue word
like Support Server
in a string, will only work in description and field value
"[JOIN MY COOL SUPPORT SERVER](https://discord.gg/yEEeeEt)"
aye
But it pop at up
not down
@slender thistle
pls
help me
it on the top
not down
I'll pretend I understood what you meant
._.
@clever vector yes
I can help
Ask me
You can just do .addField("Upper text", "Lower Text")
Oo
In description you can't do lower and upper
You gotta set description something else
Can help?
That's html
you have to do a href
no
i use Discord.js library
.addField("Gay", "[support server](https://google.com) | [some other link](https://top.gg)`");``
hi, does anyone here know how to make a web dashboard for discord.js
Thx SuperHero
hi, does anyone here know how to make a web dashboard for discord.js
@subtle osprey yes, use react
Sup x)
ok
React ?
@subtle osprey are you a full stack developer
Hmm
@pure lion
Lol this is me I'm retarded^
@restive furnace we can use html for that as well
well, i spend most time coding bots so you can call me that
Do you know frontend, backend and data shit?
:o no way!
Okok fair
@restive furnace it got an error
and its transparent on white background, how would I make it readable in light theme?
I don't use light theme
and i dont condone using it
but uh
yeah
change font color?
well it's supposed to be white
@restive furnace it got an error
it's a sans bot lol
or then just do shadow
@restive furnace it got an error
@clever vector what error...
Can you come to my code place?
I wrote a custom search algorithm just for my bot lol
it hard to explain
Screenshot could be a start 😉
what
How do i make it when the role do not have permissions it says 'none'
code:
.addField('Permissions', [
`${role.permissions.toArray().map(x => x.split('_').map(y => y[0] + y.slice(1).toLowerCase()).join(' ')).join(', ')}`,
]);```
Check if the length of the permissions array is 0
What
What are you trying to do?
I'm trying to make it so people can read the text on light theme
I dont condone using light theme because its eye cancer
Add drop Shadow?
box
I dont know any node.js text libraries that support a drop shadow
you can use canvas to render text with a drop shadow?
You should be able to
thx JonnyBnator didnt think of that
channels.cache.filter(channel => channel.permissionsFor(guild.me).has('YOUR WANTED PERMISSIONS'));
This should work @earnest phoenix

ty

I made my sans bot way too complicated lol
Complicated is good
I made a .play command which will play any command in the undertale ost, and I wrote my own search algorithm for my specific use case
which searched through a json table I put together
with every undertale song track number, track title, and filename
you can just go ".play skfjgkfsgjfkgjskgjsfk"
Just use the undertale installation and get the oggs
and it will find the closest string lol
Omg
I did
Yes
I got all the oggs but
Perfect, best bot
Even better bot
now make a deltarune music bot
Congrats on the verification
I gotta get ID first since I don't have ID on me atm
but yeah, I'll try to get him verified
Oh no
but yeah I wrote like 97 puns for the bot lol
3 more
I also make EXTREMELY SPECIFIC error handling
like, if you give it only one letter for .play it'll say "give me more than one letter, lazy bones!"
or if you give it a unicode character
it'll say "give me more than one character, lazy bones!"
same for emojis
if its a number, that doesnt error because it could be a track number


