#development
1 messages · Page 1077 of 1
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
use the dm channel id
I can read the docs I just forgot some brackets yeash?
oki, thanks

You were told like 3 times that it's a method, not a property, and you ignored that
@still merlin well it's good to remember this
But methods do end with ()
(It's listed if they're a method or not)```

Typing some long shit
(Btw it's called methods because they're bound to a property or another function, methods are functions bound to something)
Will you just stop getting mad at me, I'm trying to multitask so I didn't see the "its a method not a property" message, And don't get mad at me for stating my gender, If you don't know someones gender just call them by they/them, And I don't want to be spoonfed I just simply wanted to know why it wasnt working
he's trying to help you...
Y'all better chill

Thankyou Shivaco
I just simiply said thanks?
Thanks for what
drop it

Case dismissed
It really disappoints me when people get in here to get help but everything turns into an argument all of a sudden smh

I wanna make a custom welcome msg command
command?
Auto message he means i think
@delicate shore https://discord.js.org/#/docs/main/stable/typedef/WSEventType
You create a different one for all0
GUILD_MEMBER_ADD
A different fucntion
that'd be running a script, but i get what he meant
Its like guildmemberadd send message to "channel id "
that SHOULD return guildMember, which he can prob get channel from that
If you want to set the welcome message channel and for every guild seperately, be sure to save channel id, guild id and custom message to a database and listen to the guildMemberAdd event
If guild and channel id exists in the returns member's guild object
How to do it seperately for each server its in
Send the welcome message
Use a database
Basically
if user joins guild A, it shouldnt log on B
not taht voltrex
this
i assumed that question was him thinking it returns a user, not a guild
indeed
I know mentions exist but people get mad when you mention them mostly 
GUILD_MEMBER_ADD
@opal plank
Which intents it need?
I mean not realy mad on a bot mention if they ask for it
Ok. So I don't need to add any intents?
i dont think so, no
what?
If need help coding BDFD ping me
noted
@opal plank hey my phone died I couldn't complete question it was that I have a welcome msg for specific server in specific channel but I had problem with custom msg per server like if they do s!custommsg {user} just joined and now server has {mcount} members etc how can I allow them to use {user} as user ping and mcount as member count
replace
replace
replace
Both split/join and replace would work
let/const
var?
Ok
declare what as a variable?
Ok
nah
I did let mcount = "Your mum"
If the person types
Welcome perosn ${mcount}
So will it replace the mcount with your mum or the specific code ?
'something hello'.replace('hello', 'funny') => 'something funny'
Ok
reminder, thats global
if u do 'bob is a fatty shit'.replace('fatty shit', 'nice person'); its gonna be bob is a nice person (invalid syntax but :p)
i'd use regex or split if i were you
Regex should be avoided if possible but i still suggest using it
Idk why i said this cuz i always use it

The thing is, that split().join() replaces every single match but with replace() you can decide to replace the first match or all
You can set a limit.
I'd still use .replace though.
As you probably don't need to go String -> Array -> String
.
you do it
You can set a limit.
@sudden geyser i don't think you can set a limit
#502193464054644737 @austere axle
@earnest phoenix yes you can: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split.
However, it shouldn't be used (like you said) as leftovers are not included.
Then yes, you can't set a limit.
Because it's not.
You're calling .slice on a string.
it's not?
msg.content.substr(2).split("").join("");
It'll just return a string with some characters removed.
hi
msg.content.substr(2).split("").join("");
@warm marsh what substring?
You don't even need the .join part.
ok
It substrings the string.
``` db.set(welmessage_${msg.guild.id}, msg.content.slice(2).join(""))
this is my code
You don't need .join
ok
so i have a bot with economy commands it works all fine if i host it on my pc but when i host it on heroku it doesn't save the changes when a user earned money it's in python btw
That's a method for arrays and certain iteratables.
are you getting an error?
me?
no
ok
hacker man
i'm not getting errors
it just doesn't save
for example i run work and i earn 100 it doesn't save that
are u using a vps or a vm? or a shared vps
nope
heroku
heroku
are you connecting to the db?
but on heroku it doens't
does it connect*
@delicate shore slice() returns an string with specified amount of chars removed
Earlier we were talking about split().join() not slice().join()
What database are you trying to connect to?
how do i get that VERIFIED DEVELOPER thing
Get verified.
how do i get that VERIFIED DEVELOPER thing
@empty gust have a bot in 75+ servers and verify it https://support.discord.com/hc/en-us/articles/360040720412-Bot-Verification-and-Data-Whitelisting.
It means you added 11 guildMemberAdd event listeners somewhere in your code, which may be a memory leak.
An example of adding many event listeners is running a block of code multiple times. For example, nesting events.
let chx = db.get(`welchannel_${member.guild.id}`); //defining var
let msgfin = db.get(`welmessage_${msg.guild.id}`)
if(chx === null) { //check if var have value or not
return;
}
let wembed = new Discord.MessageEmbed() //define embed
.setAuthor(member.user.username, member.user.avatarURL())
.setColor("#ff2050")
.setThumbnail(member.user.avatarURL())
.setDescription(`${msgfin}`);
client.channels.cache.get(chx).send(wembed) //get channel and send embed
})
this is only
You probably added more unknowingly. You could show us the entire file it's in.
but is that inside another event?
but is that inside another event?
@restive furnace yes manyy
thats the problem.
You probably added more unknowingly. You could show us the entire file it's in.
@sudden geyser i searched through file and i didn't find it
thats the problem.
@restive furnace should i take it at top
that's not the point
Send the entire file in pastebin
YoooOo game engine update I drew a square that can move
ok
And shoot lines
nice
Move the client.on("guildMemberAdd"... outside of the message event
YoooOo game engine update I drew a square that can move
ok, i draw a squares which can move from node.js server with python client (bad english yes)
Every time a message is sent a new event listener is subscribed to.
You have to get the data another way.
alright
also why is bot and client different.
they are not ?
Using member
copy pasta or spoonfeeded code
? hmm
It's a small price to pay.
You should look into making your code modular.
@sudden geyser i tried but it was difficult and more over args are gonna be a problem
If you know the fs module's basic readdir function and module.exports, you'll know how to make your code modular.
they are not?
@delicate shore yes, they are. You only need one of these 99% of the time.
You only new two if ur running two bots
on the same index file
Which you can do from different files with require
maybe i will shutdown my bot for 2 days and make command handler
because it will take atleast that much time
ok
2 days?
At best a couple hours.
Yea it’s not that complicated
I meant the code from index.js
Oh yea
ok
i have one question
how do i make it locate
command file
in glitch
because glitch is bitch
The same way you'd do it locally.
and idk how to do that ../commands/music etc
Using something like fs to get all files in the specified dir then store them inside a collection or map.
It is called command handler i think
An if statement is also a command handler.
it's more of a preference
There's no benefit to either.
There's no benefit to either.
@warm marsh yes there is. It makes your code safer by you saying "all of this can't be changed unless I set it tovar/let"
...
I meant to how you use const.
const a = 10;
const b = 25;
// Is the exact same as
const a = 10,
b = 25;
indeed
ah
I know the difference between var, let, and const.
hey
thats what i meant
PG?
hey
i had one query
do i need to bring async function as well
in the command file
of modules.export?
because it says cannot use await
Depends if you need it or now.
module.exports = async () => { };
// Or non async
module.exports = () => { };
If you need it add before.
What error?
execute async
How did you use it?
not module export async
module.exports = {
async execute(params) {}
}
i have 2 questions there
do i need to place my whole code in {} of params
i mean async
depends what the commandhandler does
or not
yes
functio(param) {code}
yes
k
it can be anything
thnx
k
i am having confusion
so
const Discord = require("discord.js")
module.exports = {
name: 'meme',
description: "this is a ping command!",
execute(message, args){
if (recentcmd.has(msg.author.id))
return msg.reply(
`**You are on cooldown you can use this cmd once in 3 seconds. This is to prevent rate limting**`
);
// msg.reply("Command temporarily disabled ")
const subReddits = ["meme"]
const random = subReddits[Math.floor(Math.random() * subReddits.length)];
const img = await randomPuppy(random);
const embed = new Discord.MessageEmbed()
.setImage(img)
.setColor("RANDOM")
.setTitle(`From /r/${random}`)
.setURL(`http://reddit.com/${random}`)
msg.channel.send(embed);
msg.channel.send("**If you don't get a meme try command again in 3 seconds because our API has been malfunctioning now-a-days**")
//, "me_irl", "dankmeme"
recentcmd.add(msg.author.id);
setTimeout(() => {
recentcmd.delete(msg.author.id);
}, 3000);
;
console.log(); }
}```
i am already executing message and args
so i can add it in that field only ?
if yes then how
correction, you are passing message as the parameter while you use message.
Yes, this floor is made of floor.
ye
finnaly
it worked
thanks
if (command === "meme") {
client.commands.get('meme').execute(msg, args);
}```
alright so here
i will leave it like this onky
only
or do i have to add async here?
No.
leave it like that?
yes
const puppeteer = require('puppeteer');
const { BOT_ID, COOKIE } = require('./config.json');
if (!BOT_ID) throw new Error('BOT_ID not provided');
if (!COOKIE) throw new Error('COOKIE not provided');
const vote = async () => {
console.log('Trying to vote');
const browser = await puppeteer.launch({ headless: false, args: ['--window-size=0,120'] });
const page = (await browser.pages())[0];
await page.setCookie({ name: 'connect.sid', value: COOKIE, domain: 'top.gg', path: '/' });
await page.goto(`https://top.gg/bot/${BOT_ID}/vote`);
await page.click('#votingvoted');
console.log('Successfully voted');
setTimeout(() => browser.close(), 1000);
setTimeout(vote, 1000 * 60 * 60 * 12);
console.log('Waiting 12 hours');
};
vote();```
pls i want COOKIE
Error :
at Object.exports.run (/home/container/commands/covid-19.js:7:17)```
my code :
```js
const { NovelCovid } = require("novelcovid");
const track = new NovelCovid();```
How can I solve that 
Icero does the novelcovid package export a function or class called NovelCovid
can anyone help me ?
it is working
oh what's their last @delicate shore ?
but they said to shift to latest as it will be discontinued
read it
_1Master you have to be specific
ERROR:
at Object.<anonymous> (/app/index.js:4:20)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)```
oh what's their last @delicate shore ?
@woven sundial i don't remeber one min
if (!COOKIE) throw new Error('COOKIE not provided');
^
Error: COOKIE not provided
@mint cypress don't automate votes, it's against the rules
in ?
@slender thistle #development message 
Does anyone know how to change the default help command in discord.py rewrite? In the old discord.py, all you had to type was something like this:
client.remove_command('help')```
This doesn't work in rewrite.
OK @pale vessel
@mint cypress You are not allowed to automate voting for ANY bot
oh ok im sry idk
@heavy marsh Any errors you get?
MongooseError: Mongoose 5.x no longer supports `mongoose.connect(host, dbname, port)
About 50-100 errors.
i went to see the website but idk how i am meant to connect
Mind posting them?
@opal plank @restive furnace @misty sigil and @warm marsh thanks a ton i cannot be more grateful
@delicate shore np
Wasn't as many as it looked. I had IDLE shrunk so it looked like a lot

ping
lol
👍
Also, my code only has 74 lines so I don't know why it's saying line numbers in the hundreds.
It's updated to the newest version...
1.3.3?
I've literally only just updated it
1.3.4?
1.3.3 but if I try to update, it says it's already on the newest version
How are you updating?
const Discord = require("discord.js")
module.exports = {
name: 'tf',
description: "true/false",
async execute(msg, args){
if (!args[1])
return msg.channel.send(
"***I need a question to answer between yes/no , Stoopid***"
);
let option = ["**Yes**", "**No**"];
let Random = Math.floor(Math.random() * option.length);
msg.channel.send(option[Random]);
}}```
in my index file it was args 1 only
but since it is now a command handler
will it be args 0?
or same args
pip3 install discord
This is how I was told to update it, just by doing the install command.
pip3 install -U discord.py
discord is just a fork of an official discord.py package and God knows why it's still there
It works now, thanks!

guys can someone help me with play music command using eris?
somehow my bot didn't play the music even when everything is correct
here's my code
error
just came
can we use two command handlers
client.memes = new Discord.Collection();
const commandFiles = fs
.readdirSync("./memes/")
.filter(file => file.endsWith(".js"));
for (const file of commandFiles) {
const memes = require(`./memes/${file}`);
client.memes.set(memes.name, memes);
}
const commandFiles2 = fs
.readdirSync("./fun/")
.filter(file => file.endsWith(".js"));
for (const file of commandFiles2) {
const fun = require(`./fun/${file}`);
client.fun.set(fun.name, fun);
}
this is code
and first one is fine
in second it says cannot read property set
of undefined
oh wait
client.fun
i didnt declared it
that was the problem it worked nvm
message.channel.messages.fetch({ limit: 10}).then(messages => message.channel.send(messages.map(msg => msg.author.map(msg => msg.User.username))))
why does this send 10 promises? 🤔 shouldnt the promise be resolved, after the first then?
msg.author.map and msg.User don't look correct. What library are you using?
Why do you need two separate languages to make a bot?
is it possible to combined javascript and python ??????
@earnest phoenix yes but why
pick one language
just go with py, or js.
i dont think its impossible but i also dont recommend it
@sudden geyser it is correct tho, I was able to console log it
if (message.content === '!Sun rr') {
const exampleEmbed = new Discord.MessageEmbed()
.setTitle('Reaction Roles')
.setDescription('React to get your roles!');
message.channel.send(embed).then(msg => msg.react(':x:'))```
```js
RefrenceError: Embed is not defined```
@earnest phoenix why not just create an embed using json then send it
How do I do that?
const a = ...;
function problem() {
let out = "foo";
if (a + 1 == 5 && a + 2 == 10) out += "bar";
return out;
}
console.log(problem()); // "foobar"
solve for a
confused
@midnight blaze log it how. Through sending messages? It doesn't look correct just looking at it, hence, what library are you using?
msg.author.map ??


what is so confusing?
I am not quite sure why you guys are confused @summer torrent
because message.author is a User instance.
It's not an array or collection like flaze said
^
yes, but it still works
that's wack
🤷♂️

You can map an object
@pure lion no
e
I don't care any more I'm doing c it's cooler than js
x))))
That was a lie please help me I don't understand what the guy is saying
Ooh ooh I know
author: user { 3 }
💯% real
No scam try it and see
Not clickbait
Working 2020
just author.username?
My Bot isn’t turning on , is it a problem from discord or from my bot ?, i have no errors , it says cannot connect to host discordapp.com
Is your WiFi box plugged in
yeah, I know falzepe and that works^^ I was just wondering
why I was able to use map
I thought there must be something I am missing
Lol it wasn’t , but i reconnected and it still shows me an error.
Why don't you look at the docs
client:on('memberJoin', function(member)
local memberid = member.id
local joinAt = member.guild:getMember(memberid).joinedAt
member.guild:getChannel("735410662016155679"):send("some dude joined at "..joinAt.." !")
end)
how do i make the time more readable?
(discordia btw)
Why don't you look at the docs
@pure lion I wasn’t able to find information all it said was go to discord developer portal and it should be there but I wasn’t able to find it
@jaunty junco is this lua 🤔
@jaunty junco is this lua 🤔
@summer torrent you guessed right
also
discordia btw
implies it
Did you just ping me
Lmao
@jaunty junco there's probably a method to parse the joinedTimestamp to a LocaleTimeString
@jaunty junco there's probably a method to parse the joinedTimestamp to a LocaleTimeString
@pure lion english please
im not a machine
Idk look at the lua docs for time
eh fair enough
I'm not a CSS expert, but how do I make those lovely small pages added in the bot page?
I mean
Is there sorta template I can build on?
lua has date manipulation as well
so if u get joinedTimestamp
i think u can do stuff with it
@finite bough yeah there's probably a way to get the local time from the ms since Jan 1 1970
if (command === "avatar"){client.fun.get("avatar").execute(msg, args);}
it says cannot read property execute of undefined
why
this is my avatr.js
const Discord = require("discord.js")
module.exports = {
name: 'avatr',
description: "displays avatr of person",
async execute(msg, args){
const member = msg.mentions.users.first() || msg.author;
const Embed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setTitle(`${member.username}`)
.setImage(member.displayAvatarURL())
.addField(`Link`, `[Click Me](${member.displayAvatarURL()})`);
msg.channel.send(Embed);
}}```
xd
thanks
np
i have asked this in discord.js server but they are too busy with more pressing matters such as Help what does this error mean message is undefined
Let's say I have this directory structure.
app
├── dist
│ ├── index.js
│ ├── modules
│ │ └── module.js
│ └── shard.js
└── src
├── index.ts
├── modules
│ └── module.ts
└── shard.ts
I create a ShardingManager in index.ts that launches my shards from ./dist/shard.js when I run node dist/index while my working directory is app (it's actually done by yarn).
Now my shard's working dir is app instead of dist and it can't import ./modules/module. If I correct it to load files from ./dist/modules/module intellisense in vscode gets fucked up. How can I work around this?
@carmine echo - Would adjusting cwd settings in VSC solve it?
Not really. My .ts files are in src, not dist.
make use of __dirname and process.cwd()
whose type and why does he have a script
and doesn't fix anything
__dirname gives you the absolute path of the current file
process.cwd() gives you the absolute path of the main file
so you can load everything from process.cwd()+"/shards.js" and process.cwd()+"/modules/module"
you might need to use the built-in path module on windows to correct it, because process.cwd() returns the escaped windows path format, with double backslashes
Thank you @quartz kindle, that solved my problem!
fn.bind is not a functionerror
code :
const Discord = require('discord.js');
const configf = require("./zpremium.json");
const footer = configf.footer;
exports.run = async(client, message, args) => {
if (!message.member.roles.cache.find("name", "@everyone")) { //Whatever role you want, I pick @everyone because everyone can use this command
message.channel.send(" ERREUR : Vous n'avez pas la permission de faire ça");
return;
}
// Check for input
if (!args[0]) return message.channel.send(' ERREUR : Aucun sondage fourni');
// Create Embed
const embed = new Discord.MessageEmbed()
.setColor("RANDOM") //To change color do .setcolor("#fffff")
.setFooter(footer)
.setDescription("Utilisez les réactions pour donner votre avis")
.addField("Contenu","``"+args.join(' ')+"``")
.addField("Créateur",message.author.username)
.setTitle(`🗳️ **Sondage** 🗳️`);
let msg = await message.channel.send(embed)
.then(async function (msg) {
await msg.react("713085772470681643");
await msg.react("713085782574891110"); // You can only add two reacts
await message.delete({timeout: 1000});
}).catch(function(error) {
console.log(error);
});
};```
why do I get that error? :/
doesnt come from there
it is
yea, this code is not related
https://oliy.is-just-a.dev/ukqhpx_5149.png it isnt tho
at Map.find (/home/container/node_modules/@discordjs/collection/dist/index.js:158:21)
at Object.exports.run (/home/container/commands/poll.js:6:34)```
it might be called from there
fn is not anywhere in here
i think you somehow messed up discord.js collections
I would like to see where you got that information
Tokens are created by cryptographically signing a user ID and timestamp. Each time you refresh the page, the current time changes, and you get a new token. However, all the tokens you see are still valid until you click Generate a new token
used to yeah
@quartz kindle please educate this human
i will make a new account and try the same thing
ok i swear it didnt do that when i made prizm
but it doesnt matter because prizm wont go online anyway
something is fucked up on discord's end, it makes no sense to have your bot id encoded in base64, and have some time stamp
Snowflakes have timestamps, I dont think tokens do
They do as they change on refresh
Guys I want to do a command that awaits giving a role when someone types like "!verify me" and its gonna say "You have only been here for 10min! Please be patient and wait, try again later!" Can someone help me or send a YT link bc I dont know how to even start :/
Check the date or timestamp at when the user joined the server and see if it's longer than the desired time needed before they can use the verify command
@sudden geyser how can I do that?
I mean I have a command that tells what time and like that when they join
But idk what u say
(Since you're using Discord.js), on the message object, you have the .member property to get the guild member instance (which may or may not be null). You then have the .joinedAt or .joinedTimestamp that gets you the timestamp at when the user joined. You can them minus that by the current timestamp (Date.now()) and see if that in milliseconds is above 10 minutes.
Why not just use Discord's built-in channel slow mode?
They do as they change on refresh
@honest perch I agree, there is a time stamp. But there is also a password in there as well.
Bot_ID_in_base64 . time . Some_password
message.guild.channels.cache.find(`name`, "reports");
```doesn't work in DJS12. Anyone know the new function?
It takes a function and works as a usual array find function. The first argument would be a guild channel instance.
UnhandledPromiseRejectionWarning: RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number. error
Show us where the error is coming from
command?
Ever permissioned before
Which command and what line
ok w8
You're denying @everyone to view and then allowing?
MANAGE_SERVER is not a permission.
then
You're probably looking for MANAGE_GUILD
OK
You're denying to view and then allowing?
@pure lion the first one denies everyone permission to view the channel. The next one allows only the message author to view it, then adds the bot permission to view it as well.
Have I a problem with implementing aliases, I get no error logs or anything, so I don't see what's the problem.
Example command
message.mentions.roles.first() ||
message.guild.roles.cache.get(args[0]) ||
message.guild.roles.cache.find(role => role.name === args[0])
// If we can't find any role, then just default to the author's highest role
if (!role) role = message.member.highestRole;
let posC = message.guild.roles.size - role.position;
let pos = posC - 1;
```I tried to convert role.position in DJS v12 with ``role.rawPosition`` but it returns me that ``role.rawPosition`` is not defined...
How can I solve that?
@regal edge I think the issue here is with your message listener and using the && operator.
You're saying, "get the command by this name in the commands collection, and get this command in the commands collection by the alias name"
Try using || instead.
hmm
Your second issue is I think here: js bot.aliases.forEach((alias) => { bot.aliases.set(alias, pull.config.name) });
You're iterating over the bot's global aliases collection rather than the command's aliases array.
ohh
What is a snowflake ❄
it's an id
An ID like Menno said. There's more info on the official docs https://discord.com/developers/docs/reference#snowflakes
lol I couldn't find that one using google, thanks :)
Hey so I am trying to make a Smash or pass discord bot and I'm trying to get the images from reddit. Most subreddits are NSFW tho and apis like random-puppy or imageapi don't work when the reddit is marked NSFW. Does anyone know how to bypass this? Here is my code if you need it
const Discord = require('discord.js');
const api = require("imageapi.js")
module.exports = {
name: 'girl',
run: async (client, message, args) => {
let subreddits = [
"RealGirls"
]
let subreddit =
subreddits[Math.floor(Math.random() * subreddits.length)];
let img = await api(subreddit, true)
message.channel.send("Here's a girl image...")
message.channel.send(img)
}
}
@earnest phoenix how do i make this work for me
if you can tell me that would be great
@earnest phoenix how do i make this work for me
@earnest phoenix I am trying to make NSFW work but if you're wondering on how you can make this work on normal subreddits just copy my code and change the subreddits inlet subredditsand should work
uhhh is the module.exports required?
if you want to export it
but im literally pasting this in 1 code file
then your not exporting it
@slender thistle someones posting an invite link i think.
and insta deletion
just make a function @earnest phoenix without the exports
Screenshot in DMs
he delted it
he deleted it now
but wait
on my discord dekstop app
i have something to show deleted messages
let my discord desktop open
so then how do i make it work
@earnest phoenix just get rid of the ```js
const Discord = require('discord.js');
const api = require("imageapi.js")
module.exports = {
name: 'girl',
run: async (client, message, args) => {```
get rid of that
random-puppy functions on NSFW Sub-reddits?
f
uhh get rid of just the module.exports thing?
and start from run: async?
@slender thistle
give me a moment on my main discord app ill track the deleted message
@dense bridge dmed me with the link
he surely will be dming it to others
oh wait fuck
my disccord updated
rip discord
client mods, reported 🙊
better discord against tos
can anyone help me with opengl C?
void drawRays3D()
{
int r, mX, mY, mP, dof; float rayX, rayY, rayAngle, xOffset, yOffset;
rayAngle = playerAngle;
for(r = 0; r < 1; r++)
{
/* Check horizontal lines */
dof = 0;
float aTan = -1/tan(rayAngle);
if (rayAngle > PI) { rayY = (((int) playerY >> 6) <<6) - 0.0001; rayX = (playerY - rayY) * aTan + playerX; yOffset =- 64; xOffset =- yOffset * aTan; } // if looking up
if (rayAngle < PI) { rayY = (((int) playerY >> 6) <<6) + 64 ; rayX = (playerY - rayY) * aTan + playerX; yOffset = 64; xOffset =- yOffset * aTan; } // if looking down
if (rayAngle == 0 || rayAngle == PI) { rayX = playerX; rayY = playerY; dof = 8; } // looking straight left/right
while (dof < 8)
{
mX = (int) (rayX) >> 6; mY = (int) (rayY) >> 6; mP = mY * mapX + mX;
if (mP < mapX * mapY && map[mP] == 1) { dof = 8; } // colission
else { rayX += xOffset; rayY += yOffset; dof += 1; }
}
glColor3f(0, 1, 0);
glLineWidth(1);
glBegin(GL_LINES);
glVertex2i(playerX, playerY);
glVertex2i(rayX, rayY);
glEnd();
}
}
:D
*sad*
uh
i totally cant help dice, but im excited to see what you end up doing
can someone help me in private with my bot? don't want to spam the chat, because i dont know how to explain it.
smart
ok 
Does anyone know what is the reason for my 2 bot's token switching at the same time?
tokens only should change when you ask them to change
but it's not like that right now
Hey, can I ask how to disable skip,loop,stop if there more than 2-3 people ? because people could skip it and it's kinda annoying without DJ roles.
he was typing something before blocking me xD
prob when you banned him
can anyone covert this into a function for me?
const Discord = require('discord.js');
const api = require("imageapi.js")
module.exports = {
name: 'girl',
run: async (client, message, args) => {
let subreddits = [
"RealGirls"
]
let subreddit =
subreddits[Math.floor(Math.random() * subreddits.length)];
let img = await api(subreddit, true)
message.channel.send("Here's a girl image...")
message.channel.send(img)
}
}
const api = require("imageapi.js")
module.exports = {
name: 'girl',
run: async (client, message, args) => {
let subreddits = [
"RealGirls"
]
let subreddit =
subreddits[Math.floor(Math.random() * subreddits.length)];
let img = await api(subreddit, true)
message.channel.send("Here's a girl image...")
message.channel.send(img)
}
}```
do it by yourself

idk how to
You have a function there already
run: is a function
yes but i dont want to export it
then dont
how do i make this work without exporting
you have to export
let img = await api(subreddit, true)
^^^^^
SyntaxError: await is only valid in async function
make it async smh
isn't async
WaIt what should I replace for RichEmbed ?
for what?
MessageEmbed ?
oh djs 11 to 12 yes
anyone knows how to remove this everyone thing on the role? its on disc.py dm me if u can help plz ty
ah thanks.
:/
is there a way to prevent people from trolling if there more than 3 people in VC ?
either use a vote style system or roles
How I do that ? I guess I need to figured it out.
probably vote and roles could be used like rythm does.
some of the more popular Music bots handle it so that if there are 3 Users in VC that atleast 2 needs to skip for executing it
or you could limit it to the highest perm users in the room
yeah if there more than 3 poeple it can't be skipped without vote or dj roles.
I'm meaning about it.
@mortal dagger I don't use Python often, but the first element in the list I assume you're using (Member.roles) is the everyone role. Could you not just remove the first element from the list?
I'm testing with help command how to make the bot dm you the list of command ?
message.author.send
ah thanks again.
There's two ways about removing the everyone role;
- A list comprehension or a for-loop checking
r.name == "@everyone" - Since
Member.rolesis sorted,Member.roles[1:](ignoring the first element)
Botumu vdse kurdum fakat botumda hangi packagelerin olduğunu bilmiyorum package.json dosyasından hangileri modül?
hows 1: work?
everything after first?
you can filter out the role
so if you remove everyone role is that mean removing the owner roles to ?
A simple list comprehension as an example regarding the first option:
[r.name for r in ctx.author.roles if r.name != '@everyone']
But generally "removing the everyone role" means to ignore it, not to delete
@mortal dagger I don't use Python often, but the first element in the list I assume you're using (
Member.roles) is the everyone role. Could you not just remove the first element from the list?
@sudden geyser na dat aint work
I'm trying to put kick command at help list but it shown undefined
@pure lion I know C & I've used fixed function OpenGL in the past (if that's what you mean) -- Can't guarantee I'll know how to solve your problem though (it's been a while).
@tame shuttle sick ill send code here
Or DM Idm
.fetch() returns a promise with the collection of messages
you'll need to use .then() on channelMessages to have access to the collection
I got this error when trying to kick someone.
do you have execute function in command?
that doesnt answer the question 🤔
i tried createing a kick command it worked but i couldnt handle permissions and everyone could kick :/
help
const Guild = require("../../models/guilds");
const mongoose = require("mongoose");
module.exports = async (bot, message) => {
Guild.findOne({
guildId: message.guild.id
}, async (err, guild) => {
if (!guild) {
const guild = new Guild({
guildId: message.guild.id,
autorole: "Not Specified",
enable: false,
prefix: "/",
logs: true,
whitelistchannel: []
})
await guild.save();
return bot.guild.set(message.channel.id, {
prefix: guild.prefix,
logs: guild.logs
});
}
if (!guild.logs) {
guild.logs = true;
await guild.save();
return bot.guild.set(message.channel.id, {
prefix: guild.prefix,
logs: guild.logs
});
}
return bot.guild.set(message.channel.id, {
prefix: guild.prefix,
logs: guild.logs
});
})
};
this file is not running
help
hmmm in the kick command or ?
idk why
const { readdirSync } = require("fs")
module.exports = (bot) => {
const load = dirs => {
const events = readdirSync(`./events/${dirs}/`).filter(d => d.endsWith('.js'));
for (let file of events) {
const evt = require(`../events/${dirs}/${file}`);
let eName = file.split('.')[0];
bot.on(eName, evt.bind(null, bot));
};
};
["client", "guild"].forEach(x => load(x));
};
this is the event command
help me
yeah @fickle arch if your command handler runs .execute
the command needs to have its function named execute
what did you expect it to do @earnest phoenix
is guild defined?
i would get the guild object of the message instead of some funky import / require stuff
wait nvm
this is your model
add some console.log between the steps. so you can see if it executes but doesnt write data
also this line makes no sense for me ```
["client", "guild"].forEach(x => load(x));
@solemn latch you mean like this ?
command.execute(message, args);
} catch (error) {
console.error(error);
message.reply("There was an error executing that command.").catch(console.error);
}```
yeah
I have it.
Hi again :)
Is there a way I could see how many of my bots commands have been used?
you have execute defined in your kick command?
yes
i use prometheus to track command usage
? ok 🙂
You mean this ?
before it was undefined.
i use variables to track my command usage :)
how do you graph command usage then?
you can use a Database and just run a +1 every time someone uses a command (a timed DB like prometheus, Influxdb are better for this than Mysql, Postgres, mongodb. etc)
you can make graphs with canvas
@commands.command()
async def userinfo(self, ctx, member : discord.Member):
roles = [role for role in member.roles]
roles = [role for role in member.roles]
embed = discord.Embed(colour=member.color, timestamp=ctx.message.created_at)
embed.add_field(name="**User's status:**", value=f'User status is {member.status}')
embed.set_thumbnail(url=member.avatar_url)
embed.set_footer(text=f"Requested by {ctx.author}", icon_url=ctx.author.avatar_url)
embed.add_field(name="User's ID:", value=member.id)
embed.add_field(name="User's name:", value=member.display_name)
embed.add_field(name="Account Creation Date:", value=member.created_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"))
embed.add_field(name="Join Date:", value=member.joined_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"))
embed.add_field(name=f"Roles ({len(roles)})", value=" ".join([role.mention for role in roles]))
embed.add_field(name="Top role:", value=member.top_role.mention)
embed.add_field(name="Bot?", value=member.bot)
await ctx.send(embed=embed)
``` how do i remove the @@everyone on the role section? (discord.py )https://cdn.discordapp.com/attachments/612548053034860595/735556549292064828/unknown.png
@solemn latch So my kick script is having some issues I guess ?
yeah, you did say you where getting an error 🤔
wdym @lusty quest
@mortal dagger Show me the list expression you are using for fhe role list
dm me @slender thistle
Eh, sure
ty
so i made my own library to upload photos to instagram
since the already existing ones dont work anymore
and the developer of one of them is so toxic
like he literally trashtalked a person that reported him a bug
@commands.command()
async def userinfo(self, ctx, member : discord.Member):
roles = [role for role in member.roles]
roles = [role for role in member.roles]
embed = discord.Embed(colour=member.color, timestamp=ctx.message.created_at)
embed.add_field(name="**User's status:**", value=f'User status is {member.status}')
embed.set_thumbnail(url=member.avatar_url)
embed.set_footer(text=f"Requested by {ctx.author}", icon_url=ctx.author.avatar_url)
embed.add_field(name="User's ID:", value=member.id)
embed.add_field(name="User's name:", value=member.display_name)
embed.add_field(name="Account Creation Date:", value=member.created_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"))
embed.add_field(name="Join Date:", value=member.joined_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"))
embed.add_field(name=f"Roles ({len(roles)})", value=" ".join([role.mention for role in roles]))
embed.add_field(name="Top role:", value=member.top_role.mention)
embed.add_field(name="Bot?", value=member.bot)
await ctx.send(embed=embed)
``` how do i remove the @@everyone on the role section? (discord.py )https://cdn.discordapp.com/attachments/612548053034860595/735556549292064828/unknown.png
did shiv not help?
not rlly lol
Haha ping go vroom
my bot is 17ms
@slate oyster did you access a external API?
@solemn latch I'll say one thing in my defense
If someone was competent enough to learn python
this happens if you dont protect it properly
No
I'm using a VPS with a horrible internet connection
I'm not paying
rip
It's OVH, but somebody else is letting me share the same vps they put their bot on
ovh is ok but i dont like them
is klasa reliable ?
They (OVH) have terrible network connection
I'm back! :D
But is there a way I could log message content into a json file?
currently i use Digital Ocean but for proper servers i use Hetzner
Ah, ok
OVH has usually okish network but the issue is the firewall
@restive furnace Could use it with djs ?
yes, the stable one.
Ah, must be a poor firewall then
not poor its one of the best you can get. the issue is sometimes its slow
or filter stuff you want to use
Uh.
gateways?
gateways?
Oh, ok
Ya, my bot goes into spurts of disconnecting and not working
The other persons bot, that is on the same VPS, has the same problems at the same times, so it's not me
I think I gonna delete klasa.
you can squeze a little bit more performance out of it
I use Java (Discord4J)
then idk
with d.js there are 3-4 packages that improve the websocket speeds
this can help with the timeouts
$quer = $conn->prepare("SELECT EXISTS(SELECT * FROM guildconfig WHERE guildID = ?)");
$quer->bind_param("s", $yes->id);
$quer->execute();
$guild = $quer->get_result();
echo "<script>console.log(" . print_r($guild) . ")</script>";```
I have this code that is supposed to output 0 (false) if the guild ID isnt in the database but it always output 1 and idk why
$yes->id is the guild id
before you ask
``
i dont get the syntax. what lang is this?
php
i dont know php sry. also i think its a dead thing
i think we are a long way from php dying
^^
Ok, I have a stable connection now
But the connection goes out for 20 minutes at least once a day
is it a vps or a Root server? if it is a vps maybe try a different host
root servers should be good enought there
I mentioned I was sharing an OVH instance that somebody else is paying for
yea but if both have issues it makes sense to look for a new host
i heard ovh is known for some connection issues to discord
atleast a few years back it did
yea they filter out some stuff with the Firewall
if (rayAngle > P2 && rayAngle < P3) { rayX = (((int) playerX >> 6) <<6) - 0.0001; rayY = (playerX - rayX) * nTan + playerY; xOffset =- 64; yOffset =- xOffset * nTan; } // if looking left
if (rayAngle < P2 || rayAngle > P3) { rayX = (((int) playerX >> 6) <<6) + 64 ; rayY = (playerX - rayX) * nTan + playerX; xOffset = 64; yOffset =- xOffset * nTan; } // if looking right
err:
[Error] expected expression before '=' token
no idea what to do here, i know what the error says but not sure how to fix
i cant c ||dont laugh too hard x))))))))))))))))))))||
I don't have a CC, and am too young for paypal, so I can't exactly get a new vps
ok 😄
idk never used a game engine as a dev, only as a mapper for now
client.commands.get('trial').execute(message,args);
i wanna make a embed message come
i made the embed code but i cant make it send the embed
im kinda new to the discord bot thing so im not sure what to do
what should i add to that to make it come
@pure lion it's -=, not =-
oh wait
That's just negative, oof
#send/createMessage([id] /*eris only*/, { embed: { /*properties here*/ }});```
const mentionHook = new Discord.WebhookClient(.., ..)
mentionHook.edit(name, URL)
is this correct?
i mean
it didnt work so i am asking
Hey so I was trying to use message react with shards but keep running into problems and wanted to know if anyone could help me out a bit.
let m = await message.channel.send("hey")
return client.shard.broadcastEval('
let emote = this.emojis.cache.get("id");
if(emote){
m.react(emote)
}
')
whats the error?
حد بيتكلم عربي
m wouldn't be defined on the shard you are sending to, nor have acess to it
i wouldnt think
ive not sharded yet, but youd want to fetch that emoji right?
i think you need to run your send stuff inside the eval to share it between the shards
its possible that the eval got a different scope
or maybe just fetchClientValue
Not sure if that'll work but I'll have a look into it tonight
Any discord.py users here?
How to edit the default help command?
HelpCommand class passed into Bot's constructor or make your own
GUys what vid do I need if I want my bot to give a role when someones join?
How to edit the default
helpcommand?
@solid falcon Lol just do the same "!help" command but the command page
Guys what vid do I need if I want my bot to give a role when someones join?
also what command is it if u wanna do so ur bot reacts to ur message?
You want to mega spoonfed
okay it kinda works but sometimes the ray fractures
discordjs v11 ?
how you remove npm packages ?
I mean removing 1 package only.
nice.
depends
your code needs to pause while the gc is cleaning up but usually it doesnt take long
on the other hand if your code has, say a memory leak it will exponentially take longer
if you have a real time app and this happens it will cause problems
ok how about every minute
guess it's up to you
but https://stackoverflow.com/a/32826201/4926527
Running global.gc() manually (enabled with node --expose_gc) would reduce memory usage by 50MB every time and would pause the app for about 400ms.
wont manually running the garbage collector result in spikes in usage
I know that cpu usage can spike with gc
yea it will
just updated discord.js and all my code was instantly screwed
fixed a few commands
annoying but meh
intents and stuff make it worth it
what do intents even do lmao
free up your bandwidth
@solid falcon Lol just do the same "!help" command but the command page
@autumn aspen I mean, how to edit the return message, I want to edit to embed message
i have enough width in my band to not need that
intents are what you get from discord.
by only using certain intents you limit whats cached, and bandwidth usage
from what tim has done, he's used 5x less bandwidth
just with disabling presence updates
yeah
yeah. its a great update for bot devs and discord
So me and my friend we made an NPM package and we can't add myself to the Collaborators anyone knows how to do it?
It just shows my friend
Hey so I am trying to make a Smash or pass discord bot and I'm trying to get the images from reddit. Most subreddits are NSFW tho and apis like random-puppy or imageapi don't work when the reddit is marked NSFW. Does anyone know how to bypass this? Here is my code if you need it
const Discord = require('discord.js');
const api = require("imageapi.js")
module.exports = {
name: 'girl',
run: async (client, message, args) => {
let subreddits = [
"RealGirls"
]
let subreddit =
subreddits[Math.floor(Math.random() * subreddits.length)];
let img = await api(subreddit, true)
message.channel.send("Here's a girl image...")
message.channel.send(img)
}
}
Where's the array?
arr.reverse();



