#development

1 messages · Page 390 of 1

edgy needle
#

will if(message.author.bot) {
return;
} work

#

v

#

if(message.author.bot) {
return;
}

#

cuz i dont want bots to be able to use the command

#

s

terse badger
#

Code block pls

#

And it should?

#

Why wouldnt it?

#

(i dont know djs but..)

earnest phoenix
#

yes .author.bot is good

edgy needle
#

ok ty

#

ima try it

floral stone
#

The json is sent from webhook on upvote, right!?

terse badger
#

Yes

#

Thats how webhooks work

floral stone
#

I didn't receive it though when a friend upvoted

#

The webhook test worked though

#

hmm

#

Language!?

#

Try checking out Flask

earnest phoenix
#

wat lang is ur bot?

low owl
#

Java

earnest phoenix
#

channels send like <#channelid>

low owl
#

Mh, haven't done regex in a while actually

earnest phoenix
#

so u can just remove the <# and the >

#

no

#

[#development](/guild/264445053596991498/channel/272764566411149314/)

#

send dat in chat

low owl
#

<#[.+>

#

or something like that

#

Aw, it removed the \'s

#

Well, the . is "any character"

#

and .+ any character n times but at least 1

earnest phoenix
#

cant u do .substring()? in java

low owl
#

Oh right, we talk about digits

#

whoopsy

earnest phoenix
#

¯_(ツ)_/¯

low owl
#

What you also could do is (.Net equivalent)
string[] words = string.Split(' ', message) and then find the ones starting with <# and ending with > and try to Parse them to an existing channel in your guild.

earnest phoenix
#

cant u find channels with ids?

low owl
#

Yes

earnest phoenix
#

¯_(ツ)_/¯

low owl
#

Yeah, that's what I meant

#

actually the same thing

earnest phoenix
#

same xD i just havent touch java for 2 years

low owl
#

I mean almost the same thing, except you also Parse by name

earnest phoenix
#

so new to materialize and its pretty nice

low owl
#

What's that?

#

And also, what are you trying to achieve Wintery?

#

Didn't say a thing 😛

edgy needle
#

Does anyone know a nsfw and hentai api?

idle mountain
#

@edgy needle find a website that has those things and look up "[website] api"

#

there are dozens

edgy needle
#

im searching

#

but i cant find one that works

low owl
#

Then you are not searching good enough

earnest phoenix
#

@edgy needle pornhub. . .

edgy needle
#

noo

#

i dont need that

#

i need to site to show

earnest phoenix
#

just try to use an nsfw command in the nsfw testing and see wat they use

edgy needle
#

{"file":"https://purr.objects-us-west-1.dream.io/i/13444283_10153573665666516_637228041_n.jpg"}

low owl
#

Dude, either you rephrase your problem or you read

#

Because right now I have no idea what your actual problem is

edgy needle
#

i dont think they will work

#

but ima try em

low owl
#

Not really, but there are so many people asking the same simple questions every day again

earnest phoenix
#

ikr

low owl
#

Which could 90% of the time be resolved by actually researching. That's one of the greatest skills of a good dev and yet.. ah

#

I will just stop ranting and go shopping. 😐

#

When I was 14 or so and started developing I learned everything by researching

#

never asked someone else except I really was stuck for a while

#

few minutes

#

:triggered:

#

Well

#

this might just be the wrong community for me overall then 🤔

#

or at least the dev channel

uncut slate
#

if you're annoyed by people asking very googleable questions, yes, this is not the right place for you

earnest phoenix
solemn obsidian
#

Development related tho

uncut slate
#

this is development-related talk @earnest phoenix

earnest phoenix
#

tru

#

Anyone help me for new upvote sistem pls..

uncut slate
#

check the channel topic

storm thistle
#

How do I make my bot play a youtube video

terse badger
#

Depends on the library..

storm thistle
#

I came on this

#

Because that's how I play gifs

#

but video is then picture

#

So I tried video

terse badger
#

Do you want it to send the audio into a voice channel or

storm thistle
#

No that it plays a video

#

(That video link)

terse badger
#

You cant afaik 🤔

#

Unless people click on the video

storm thistle
#

That's what I meant

terse badger
#

Just post the link?

storm thistle
#

Yea

terse badger
#

I dont get what youre having trouble with

storm thistle
#

How do I make it post the link when I do %AfroCat?

terse badger
#

😶

storm thistle
#

Like message.channel.send("link")

terse badger
#

How do you determine what video to send

steel tinsel
#

My question is: why is my bot not getting popularity?

earnest phoenix
#

eh

#

like what

low owl
#

Well, what can your bot do? Why should I have it?

steel tinsel
#

It's not in many servers

#

Intense moderation

earnest phoenix
#

my bot is in 23 servers, I think yours is probably in more 😛

steel tinsel
#

It's in 12

earnest phoenix
#

oh

#

well, try adding some funny commands I guess 😉

steel tinsel
#

No

solemn obsidian
#

its called patience

low owl
#

What is intense moderation?

steel tinsel
#

It's meant to do moderation and stop

earnest phoenix
#

oh

steel tinsel
#

Intense moderation is detecting spam intensively

#

Plus detailed logs

earnest phoenix
#

hmm

#

try telling some people about it

low owl
#

Okay, that is pretty cool. Unfortunately there are very popular bots that do this already.

#

You need to do something unique, something that makes you different, while being at least on the same standard they are.

earnest phoenix
#

yee boi

steel tinsel
#

That's what I'm trying

terse badger
#

Find issues with other bots and dont have them in yours

earnest phoenix
#

well most people wants more than only moderation in a bot..

low owl
#

And this can take time. But not only that, you also need to have some skill in bringing your product to the end user. Make it descriptive, catchy, make them want to try it.

#

Then it will spread 😛

terse badger
#

Use other bots and see what they lack in their features

steel tinsel
#

I am

earnest phoenix
#

like dyno

low owl
#

Can you post me your DBL link?

steel tinsel
#

They lack of much customization

#

-bots

gilded plankBOT
#
MoonlightCapital#0554
Bots

@slow fable

steel tinsel
#

This maybe

low owl
#

That's fine, second..

steel tinsel
#

-bot @slow fable

#

Idm

#

Idk

earnest phoenix
#

xD

low owl
#

Uhm, no offense, but you should work on your picture

earnest phoenix
#

I think its -botinfo

steel tinsel
#

Yeah

#

It's temporary though

low owl
#

Often people just look at something like that and already say "well.. probably not that good"

earnest phoenix
#

maybe the picture makes it unpopular..

#

make some clickbait picture to it

steel tinsel
#

I can't make anything good with my software/skills

earnest phoenix
#

saem

low owl
#

My next question would be, in your pictures is a non english footer, why is that?

steel tinsel
#

Because it's a translation of my private bot

earnest phoenix
#

oof

low owl
#

Well, make it english.

steel tinsel
#

I will when I get my pc

#

Btw are the logs ok?

low owl
#

Seems so

#

"settings system is a bit rough, but the bot should run smoothly" that's not very good advertising

#

Kinda scares people away that would otherwise try it

steel tinsel
#

But I can't even lie

low owl
#

@steel tinsel You are not lying if you don't mention it. Next thing please god don't have a unique prefix for each command.

steel tinsel
#

?

low owl
#

"MoonlightBot has an unique prefix for most tasks."

steel tinsel
#

It only has one prefix

low owl
#

Kinda sounds like multiple prefixes

steel tinsel
#

Oh

#

I'm bad at wording

terse badger
#

Yea im with Brian

low owl
#

Well, to round it up I would describe more what makes your bot special. Right now you only say.. well it has moderation features. But most bots have these.

steel tinsel
#

I'll reorganize the description when I get my pc

storm thistle
steel tinsel
#

?

storm vessel
#

so I'm trying to make a bot for a server I'm in and I can't find many tutorials for stuff

#

I have the bot ready

#

and I can do simple commands

#

but can someone explain how to do stuff like role or user specific commands

#

I'm using the java Maven JDA

inner jewel
#

you'll want Member#getRoles() and User#getIdLong()

storm vessel
#

so once I have someone's role how do I use it in something like an if() statement to make it so that only someone with that role/name can use the command?

inner jewel
#

if(member.getRoles().stream().anyMatch(r->r.getName().equals("the role name you want"))) {

}

storm vessel
#

thanks

earnest phoenix
#

in discord.js what is used to see which role mentioned role is for the bot? Thonk

torpid frost
#

best way to test send message permission on jda?

lavish mango
#

@earnest phoenix what

inner jewel
#

@torpid frost Member#hasPermission(Channel, Permission...)

torpid frost
#

thx

earnest phoenix
#

like

#

for example: ?role add @heavy berry @Mod

#

the @Mod thingy

lavish mango
#

you could do Mod

earnest phoenix
#

like mentioning

lavish mango
#

mentioning the role would change it to an id

earnest phoenix
#

mm

lavish mango
#
  let roletogive = message.guild.roles.find('name', roleName)
  if (!roletogive) return message.channel.send("Role may not exist make sure you spell it exact")
  message.guild.member(user.id).addRole(roletogive);```
#

is what i do for giverole

earnest phoenix
#

well I fixed so it works to type the id only or the name of the role, but on a server they have emojis and stuff and its needed to @ sometimes and they mostly use @

lavish mango
#

hmm

storm thistle
#

Oh

high tinsel
#

Is there someone who uses glitch.com to host their bots?

lavish mango
#

ive set up a bot for someone on glitch before

high tinsel
#

i put this into the main .js file:

#

var express = require('express');
var app = express();
app.use(express.static('public'));
app.get("/", function (request, response) {
console.log(Date.now() + " Ping Received");
response.sendFile(__dirname + '/views/index.html');
});

#

and I tested that website on another server where it works...

lavish mango
#

try editing your package.json

#

add a new start

#

like "start": "node bot.js", "start": "node website.js"

inner jewel
#

that's not how json works

high tinsel
#

plus i have both the bot and this code in server.js

lavish mango
#

it worked for me

#

my testing bot on glitch now has a website

high tinsel
#

What code is in your node website.js?

lavish mango
#

The default server.js

#

That loads the index.html

#

Just renamed

lavish mango
#

Hmm

inner jewel
#

having repeated keys is undefined behaviour

#

some parsers might consider it an error, some (like JSON.parse) will use the last value, etc

lavish mango
#

Oh yeah

#

I haven't used jsons in awhile

#

Use sql now

gilded blaze
#

SQL !== JSON

high tinsel
#

No matter what I do... I already got that code I posted here from the officiall glitch forum it just does not work...

topaz fjord
#

You got an error

#

?

high tinsel
#

Every time the same two errors... either 504 Gateway Time-out or the generric check your code message...

topaz fjord
#

Did you check.

#

Also why use glitch

#

Why not a real host

high tinsel
#

Because it is free and I am a poor student...

#

and I want the website hosted on the same place where the bot is...

low owl
#

@nimble merlin How can it be against copyright to use their Emojis in your commands?

inner jewel
#

because legal reasons

low owl
#

But he never actually copies them or such alike, right? I always thought these Emojis belong to Discord..

inner jewel
#

inb4 discord tos allows it

low owl
#

Mh, interesting. I'd think so

elder rapids
#

discord tos allows it

#

Let me check on that now 👀

inner jewel
low owl
#

Alrighty

elder rapids
#

Considering Discord allows using emotes from other servers.......

earnest phoenix
#

could express npm cooperate with apache Thinkinggg

elder rapids
#

Unless you upload the emote yourself I doubt you can get in trouble then

prime cliff
#

\👑

elder rapids
#

As long as it's directly from this server's emote list (global emotes)

prime cliff
#

You could always use that mmLol

elder rapids
#

Since Discord has a license to use the emote and they specifically allow the usage of global emotes from other servers I doubt you can get into legal trouble for using it as long as the emote is directly embeded from this server such that you did !dblSupporter

#

for example

#

In other words, don't upload it to your own server and use that emote ID use it from here

#

wot

#

No permission to use external emotes...?

#

check for user id...?

#

why

terse badger
#

@earnest phoenix what do you mean

loud bear
#

anyone here knows how to disable command not found error for certain guilds? discord.py rewrite branch

fathom pebble
elder rapids
#

Most likely

loud bear
#
@bot.event
async def on_command_error(ctx, e):
    try:
        if isinstance(e, commands.CommandNotFound):    
            await ctx.send("command not found")
        elif isinstance(e, commands.NotOwner):
            await ctx.send("you can not use this commands you are not the owner of CookieBot")
        elif isinstance(e, commands.MissingPermissions):
            await ctx.send("I do not have the permissions to do that")
        elif isinstance(e, commands.BotMissingPermissions):
            await ctx.send("I do not have the permissions to do that")
        elif isinstance(e, commands.CheckFailure):
            await ctx.send("An error has occored while trying to perform this command")
        elif isinstance(e, commands.BadArgument):
            await ctx.send("you have gave me a bad argument")
    except Exception as e:
        print(e)``` this is what i have how would i disable them for this guild only?
elder rapids
#

Disable command not found entirely

#

Bad practice

torpid frost
#

or find this guild id and do a check for the guild the message come from

#

in jda is not member.haspermission(Permission.ADMINISTRATOR)?

#

or as i've done in mine the owner sets a list of roles that are "modroles"

#

is that what you asked?

#

(ps sorry for my bad english)

#

the emoji is a server emoji or a default one?

#

so if a user have not the nitro he cant use emojis from other server also in theyr nickname

#

you should add the same emoji in every server you want to show it

#

yes but not on a user nickname

#

where the emoji might be shown?

#

oh embedded?

#

embed*

#

soo... idk how it works but if i remember right external emojis have a different syntax than guild ones

#

if you use embeded you could directly set a image next to the user line in embed

#

you'll need a bit ofbtests

#

yeah

#

that's right

#

imma see a sec

#

you know emoji id?

#

you tryed to use it instead chat syntax

#

nono i understood

#

the emoji is now show out of the server the emoji is created right?

#

nono that was not what i meant

#

but yes i've not understood the problem is bot not adding it or emoji that is written as chat text?

#

well you use a database?

#

lel what api do you use?

#

i'm good whit sql

#

you should use something to interface whit discord

#

i mean : what language you use?

#

mmm ok

#

you have a server/VPS where you host the mysql daemon?

#

so you tried where to connect?

#

nope mysql is a server - client database

#

try for sqllite so

#

it's a file based database

#

you'll have to create a *.db file in a folder near your app

#

and connect to it using proper driver

#

as i see on google sqlite is easy to use in python

#

once you set it up mention me if you need help on SLQ queryes and commands 😬

#

uh k well if you want only local

#

try creating a list of user id that in your server have that role
then once your bot receives the command compare ids from that list

#

if the bot crashes all will be loose but you could always recreate it

loud bear
#

how on earth do we get the emotes id's

languid dragon
#

\:lul:

#

like that

elder rapids
#

won't work in other servers :c (just side note)

torpid frost
#

as i said it works only on the server that owns the emoji 😅

floral stone
#

the bot can send it if they have external emoji permission

#

Bots have global emotions

earnest phoenix
#

wew

floral stone
#

Unless you as a user without nitro is sending it, then it won't work.

earnest phoenix
#

so bots is like having nitro stuff?

elder rapids
#

Bots have global emotes

#

That's it, they don't have anything else

earnest phoenix
#

kewl

loud bear
#

I just tried it and it worked fine and i do not have nitro

elder rapids
#

mm?

floral stone
#

did you send the message or the bot

#

Was the emoji in the server that owns it

loud bear
#

I used a test command with my test bot and it send an emoji from my server on another server that did not have that emote and it sent it without issues

#

in fact the server i used the command in have no custom emotes

elder rapids
#

Because bots have global emotes lol

loud bear
#

I only have global access to emotes from 4 servers

trim plinth
#

@abstract aspen avatar @topaz fjord

loud bear
#

well bots dont have access to every emote only the emotes that the bot is in lol

west current
#

So uh, my bot @supple marlin

#

The user count is 6440

#

The amount in this server is 13355+

#

The code I had is client.users.size

uncut slate
#

6440 is likely the amount of cached users

west current
#

Mm

#

So how do I fix that

uncut slate
#

there is nothing to fix, that's the "proper" value

west current
#

Fuck mate

earnest phoenix
#

(discord.js) how would i ban a user using their username?

#

uh, well why not mention em

#

i have that done, also id but i would like to use username as well

#

oc

#

oh well use like args.slice(1) or whatever it is you do I forgot and then blah blah

#

i have that, just need to find the user

#

ooh

#

client.users.get(dingus).ban or somethin

#

naw

#

not right

#

dats wrong

#

message.guild.client.users.get(dingus).ban maybe?

#

naw

#

i dont kno xd

#

🤔

#

there are good youtube tutorials

#

sometimes

#

not the best tho

#

uh idk

#

anyone have any success checkmark gifs

low owl
#

Depends on your personality

#

I learn best by watching someone do it and try to replicate on my own for example

#

anything I stumble across then I'm going to research

#

Never touched Js

#

😅

#

Probably not that hard when you've already done something else so

#

most likely you will have trouble with syntax and its weird comparisons

#

like ===

#

or let and var

#

Probably just flying over this and see what you struggle with

#

or what is new

uncut slate
#

Express is definitely what you want to use as a beginner, but Koa is an underrated alternative, although slightly more advanced

#

Yeah, if you're starting out, Express will be easier to understand.

#

Middleware is one of the things that you really should grasp for JS, and Express is good at teaching you that

#

Oh you can definitely use Express if you're proficient too

low owl
#

Well, before you get proficient you have to be a noob 😛

uncut slate
#

it's incredibly widely used

low owl
#

Well, you will know something

#

you just need to start tbh

#

@uncut slate Since you are there right now, man am I excited to get the bot declined 😂

uncut slate
#

Which bot? 👀

low owl
#

Animus, but whatever. No pressure. Will the botpage be deleted when it is declined?

#

I might want to do a backup of that then

#

Yes I know, the next days.

uncut slate
#

It will be, yes

low owl
#

But I want to know if something like that is even wanted

#

Alrighty, quickly backing that up then. I liked how the text turned out.

#

Yea, it took me quite a while to get a base to work with

#

Uhm, let me see..

#

Mh, probably something basic

#

Originally I wanted to spent the week implementing various data collection things, but before I spent time on that I wanted to have all the basic features you would expect done.
Moderation, Google Search in case a phrase isn't understood and more error handling.

#

That would be an option

#

That's where data collection comes in

#

I'd simply make statistics and look through some phrases it often seemed to miss. That's probably the one with the least coding work but most manual search.

#

Sure, but that is a lot of work

#

You still need some sort of data set to work with

#

So you'd need to feed it n number of phrases from the personality you want to create

#

other than that I can only think of "pseudo" personalities

#

Need to research that

#

But I guess you mean something like there is a dataset the bot can use and it will just randomly build a sentence together based on predefined parts

#

I think with my current knowledge and experience that will take way too long to develop

#

And I don't have the datasets for such things

#

Well, the data needs to have some minimum amount of quality

#

of course you could just take all messages from a random person here and put them in the AI

#

but don't expect the outcome to be great then

#

You would still need to kind of normalize the data btw.
In the end you want to have something like magicAi.GenerateAnswer(MyIntentionAsString)
which means you have to somehow map some the data to the intentions

#

Which probably isn't even the right way to tackle this at all, but how else are you gonna tell your AI later what you want from it?

#

At that point it might just be easier to write like 10 variants for each message in your bot and pick one at random

#

Neither is there in preparing a dataset with thousands of sentences 😐

#

But well, there are probably other approaches to such a problem I can't think about right now

#

Don't say that, it's a good idea

#

It would be very nice to have the feeling to talk to a human and not a bot. That's a very nice motivation.

#

Uhm, yea, I agree Wordpress is not particular nice to work with

#

But for a lot of people with a low budget perfect

#

I'd even consider myself just taking some template and inserting some text. I simply don't have the time to work on the bot, website and uni.

earnest phoenix
#

You dont need a website

#

to accept webhooks

#

its not

#

Just run an http server

#

accept post requests that have the auth key you inserted into your dbl webhook, then take the user ID from the post data and insert it into whereever you put your upvoter IDs

#

y r u using wordpress

#

Ok so where are you storing upvoters

#

what kind of database

#

Ok what lang are u using

#

errr for upvote getter

#

Just use node

#

it's very easy

low owl
#

Probably only a few lines 👀

earnest phoenix
#

it will only be a few lines ye

#

I mean a simple webserver can be just ```js
const express = require('express')
const app = express()

app.get('/', (req, res) => res.send('Hello World!'))

app.listen(3000, () => console.log('Example app listening on port 3000!'))

low owl
#

(hint: I think someone opensourced his stuff that does exactly that)

earnest phoenix
#

except instead of app.get

#

you do ```js
app.post("/dblwebhook (or whatever you want to name it)", (req, res) => {
// yada yada yada
})

#

and then you just do a simple auth header check

#

just an if statement

#

and then you insert the user data from the object given

#

into ur db

#

wdym front end

#

U use javscript

#

instead of php

#

it's well worth it

#

but with that you dont need any front end

#

to get an upvote webhook server

low owl
#

He wants to get rid of wordpress, nothing to do with the webhook thingy

#

I swear, the best advice you've ever gotten is to just start

earnest phoenix
#

You can just look through several articles

#

Well that's just some guy writing an article

low owl
#

Keep in mind that you won't learn it from this blog post

earnest phoenix
#

^

#

It's just

#

A place to start, yaknow?

terse badger
#

Its all abstracted away

#

Ye

low owl
#

Good night

static oasis
low owl
#

@static oasis Probably commented out

static oasis
#

oof

terse badger
#

Brian you genius

static oasis
#

is dblstatslk a good command name for a command that looks up a bot's stats on dbl?

hushed berry
#

no

terse badger
#

dbl stats [id]

#

Use command arguments

loud bear
#
bot.loop.close(status_task())
TypeError: close() takes 1 positional argument but 2 were given

oof

frosty sierra
#

its back now

#

online

#

it was really weird

loud bear
#
@bot.command()
@commands.is_owner()
async def loop_start(ctx):
    bot.loop.create_task(status_task())
    await ctx.send("Status loop Enabled")

@bot.command()
@commands.is_owner()
async def loop_stop(ctx):
    bot.loop.close(status_task())
    await ctx.send("Ststus loop Disabled")

@bot.event
async def status_task():
    while True:
        await bot.change_presence(game=discord.Game(name="Being Coded"))
        await asyncio.sleep(15)
        await bot.change_presence(game=discord.Game(name="use C!help for command list"))
        await asyncio.sleep(15)```
how would I fix the loop_stop command?
#

ping me if you think you know how to fix

#

lol

terse badger
#

@bitter sundial also, you mentioned "why does netflix use nodejs". I know someone who knows a netflix lead architect. They use it for streaming aka heavy io, what node was designed for.

floral stone
#

Has anyone sucessfully get discord-oauth2-example working?

#
topaz fjord
#

ye

#

use passport.js

floral stone
#

in python

topaz fjord
#

oh

#

i dont use it so idk

floral stone
loud bear
#

Linux nice 😃

inner jewel
#

did you add the redirect uri to the bot app page?

floral stone
#

This is for a personal site

inner jewel
#

again, did you add the redirect uri to the bot app page?

floral stone
#

Yes

#

https://discordapp.com/oauth2/authorize?response_type=code&client_id=274620011744854029&redirect_uri=http%3A%2F%2Falicebot.pw%2Fme&scope=identify&state=HiVsDW64re7UUSmGpWZGCMl8twlUly

earnest phoenix
floral stone
#

ah ok

earnest phoenix
#

in ur bot page

#

@floral stone u trying to make a weeb dashboard?

floral stone
#

Yes

#

i added it

inner jewel
#

tfw half the bots have dashboards now

earnest phoenix
#

ikr

floral stone
#

Still seems blank

#

https://discordapp.com/oauth2/authorize?response_type=code&client_id=274620011744854029&redirect_uri=http%3A%2F%2Falicebot.pw%2Fportal&scope=identify&state=l1vA2VtFcWWlV3sAs9PwCXtqMPCsmQ

earnest phoenix
#

🤔

inner jewel
#

did you add the right uri to the bot app page (including http/https and path) and save it?

earnest phoenix
floral stone
#

woop

#

worked

earnest phoenix
#

ok

floral stone
#

{
"connections": {
"code": 0,
"message": "401: Unauthorized"
},
"guilds": {
"code": 0,
"message": "401: Unauthorized"
},
"user": {
"code": 0,
"message": "401: Unauthorized"
}
}

#

hmm

#

why is it still unauthorized after i completed the login

earnest phoenix
#

¯_(ツ)_/¯

floral stone
#

This is confusing me, it's the same code...

#

UGH

earnest phoenix
#

i dont understand py 😦

floral stone
#

Should i be redirewcting to my /me or /callback?

#

callback, right?

topaz fjord
#

callback

floral stone
#

thought so

#

that was my problem

#

it works

#

Thanks so much for y'all help!

#

oh

#

need to update the headers

earnest phoenix
#

@floral stone change Portal -> Login

floral stone
#

Why?

earnest phoenix
#

idk Portal seems like a blank thing

#

wat u using for the backend?

floral stone
#

blank how

topaz fjord
#

Portal is like 2010 shit

earnest phoenix
#

^

#

Login makes more sense tbh

floral stone
#

I like portal

earnest phoenix
#

Personal preference cant bother xD ¯_(ツ)_/¯

floral stone
#

anything else?

earnest phoenix
#

the desc and image in embed?

floral stone
#

fixed

earnest phoenix
floral stone
#

it's cached

earnest phoenix
#

ok

#

well its all ok now

loud bear
#

discord.py rewrite branch how would i make my bot show how many users the bot can see?

floral stone
#

@loud bear py len(self.bot.get_all_members())

#

that should return the amount

loud bear
#

ok thanks I find it easier to ask here then to spend hours trying to make it work with the online docs lol

floral stone
#

Use ctrl+f or the sidebar to navigate

loud bear
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: object of type 'generator' has no len()

#
await ctx.send("I can see {} users".format(len(self.bot.get_all_members())))```
floral stone
#

await ctx.send("I can see {} users".format(len(list(self.bot.get_all_members()))))
Convert it to list

loud bear
#

and is there an easy way to make a restart command so i dont need to keep restarting the bot every time?

floral stone
#

I have my bot running with upstart

#

It restarts automatically

#

It's been like that for years, I got the guide from somewhere. I think it's red docs.

low wasp
#

or u can use PM2

topaz fjord
#

pm2 for python Thonk

loud bear
#

and also im having issues with how to stop a loop after it started

floral stone
#

you use break

low wasp
#

pm2 can be used for more then python

floral stone
#
while True:
    if something == something:
        break```
#

it will break out of the loop and go to whatever is enxt

loud bear
#
@bot.command()
@commands.is_owner()
async def loop_stop(ctx):
    bot.loop.close(status_task())
    await ctx.send("Ststus loop Disabled")```
so its not possable from a command like this?
#
@bot.command()
@commands.is_owner()
async def loop_start(ctx):
    bot.loop.create_task(status_task())
    await ctx.send("Ststus loop enabled")```

this works fine but the stop one not working
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: close() takes 1 positional argument but 2 were given error given from console

#

@floral stone thanks for the help on my users command

floral stone
#

First, it should be self.bot (You are using the command wrapper, right). Second, I haven't messed with running background loops but try looking into using asyncio. Finally, if you have any questions about the discord py api or python in general, feel free to dm me.

#

@loud bear

loud bear
#

i, looking at the pages now

snow talon
#

:3

coral lichen
#

In all discord langs,
Sending an image is the same of sending a gif in embeds

frail kestrel
#

discord lang

earnest phoenix
#

you guys know how i would use express to link with uh nginx for the webhooks?

lethal sun
#

I have no idea how to put variables in this code:

const unifiedCrawler = require('appstore-playstore-crawler-api');
unifiedCrawler.apple.getSearchResult('Uber', '1').then( result =>
            //here
        )```
My goal is to put the results in an embed like this:
```js
const unifiedCrawler = require('appstore-playstore-crawler-api');
unifiedCrawler.apple.getSearchResult('Uber', '1').then( result =>
            var embed = new Discord.RichEmbed()
            .addField("Name:", result[0].title)
            .setThumbnail(result[0].icon) //etc
            ;
        )```
But I always get errors such like:
```SyntaxError: Unexpected token var```
Also, if doesent work either.
Node.js / discord.js
#

I tried making the result to be a function like:

const unifiedCrawler = require('appstore-playstore-crawler-api');
unifiedCrawler.apple.getSearchResult('Uber', '1'), function(result) {
            //code
        }```
But, doesent work.
#

Please help.

glossy oracle
#

insert an infinite amount of facepalms

#

Syntax error

lethal sun
#

ok shaddap

#

i admit that im a nub

spring ember
#

You forgot {} after the =>

#

I think

earnest phoenix
#

Hello

#

can i save the script for my bot

#

im using Visual Studio

#

and im upgrading to Microsoft Visual Studio Professional 2017

#

and i even save my scripts

#

or remake

#

dm me

#

if u know

gilded thunder
#

Why doesn't this work? ```python

purge command

@bot.command(pass_context=True)
@commands.has_permissions(administrator=True, manage_messages=True)
async def purge(ctx, amount):
await bot.purge_from(ctx.message.channel, limit=amount)

merry stirrup
#

Can someone help me with looping all users?
Am trying to make a membercount that shows all users, all online users, all dnd, ....
like the membercount is done
just not the status section
( Language = JavaScript )

gilded thunder
#

Got my code fixed.

#

Ghost ping :/

gilded thunder
#

Why doesn't this work, again.

# cat command
@bot.command(pass_context=True)
async def cat(ctx):
    """Purrr."""
    embed = discord.Embed(title="Meow!", description=" ",
                          color=0x146aeb)
    embed.set_thumbnail(url="http://aws.random.cat/meow")
    await bot.say(embed=embed)
ruby dust
#
  1. if you don't want to specify the description, then don't add that parameter
  2. is random.cat suppose to be a site or an API?
low owl
#

Probably returns a random cat image

gilded thunder
#

The link I used is an API.

ruby dust
#

but you aren't really doing the API call... you just literally provided a link to that site, and it's what it tries to do

gilded thunder
#

Gives this when you load the link, or something similar {"file":"https:\/\/purr.objects-us-west-1.dream.io\/i\/xmas-just-in-time.jpg"}

floral stone
#

You need to use aiohttp to get the json from the site and then the url.

#

@gilded thunder

gilded thunder
#

Found another API.

floral stone
#

ok

topaz fjord
#

Lmao

scenic crest
#

If I have a regular expression that's

Hello my name is [a-zA-Z]```

what's the best way to replace the [a-zA-Z] with something in Java/JVM? What about having multiple names?
inner jewel
#
Hello my name is (\S+)(\s+\S+)*```
low owl
#

Your regex currently only describes a lower case a-z and then an uppercase A-Z

inner jewel
#

actually that one is just a single letter

karmic parcel
#

yup

#

lowercase or uppercase

inner jewel
#

[a-zA-Z] matchest a single letter from a-z ignoring case

#

""ignoring""

scenic crest
#

it's just an example regex

#

not actually handling names

edgy needle
#

does anyone know how do i use yanda.re as a api?
Language: JavaScript

low owl
#

Like you consume any HTTP Rest API? 🙃

floral stone
#

How Is it

abstract crystal
#

don't like it

#

it stores data in json files

#

and you still have to read them

#

meh

floral stone
#

I could use mysql but I don't have the time

#

it's there for people in case someone needs it

abstract crystal
#

one idea would be an implementation with ngrok or sth
for the db, use sqlite

#

simple and no conf needed for the end user

floral stone
#

ok

#

I probably won't add it

abstract crystal
#

xd

floral stone
#

fork if you like

#

I have other things to do

abstract crystal
#

i'm working on my own lib

floral stone
#

nice

abstract crystal
#

webhooks as a service and a websocket connection for the lib

#

complicated ik

floral stone
#

language?

abstract crystal
#

py

floral stone
#

nice

abstract crystal
#

just have to find some easy to use dynamic url websockets or sth

inner jewel
#

i have one using redis

#

pubsub/rpush + blpop work really well for basic ipc

abstract crystal
#

fun fact: docs

lavish mango
#

@nimble merlin role_permissions

#

I'm going off a website I don't do py

upper ember
#

The token of my bot changes every time I do refresh the page, as a result of which I can not run my bot, I tried to create a new token manually, and it still keeps changing

it says "This token changes on page refresh and is valid unless manually regenerated below."

inner jewel
#

all the tokens generated are valid

#

they only get invalidated when you click on reset

upper ember
#

Ok

#

So how do I start my bot?

inner jewel
#

you... run it?

upper ember
#

I can’t

#

It keep changing

inner jewel
#

just use any of the tokens

upper ember
#

@inner jewel not working

#

@earnest phoenix

#

Still offline

abstract crystal
#

@nimble merlin if you want to add a role to a user on guild join then use on_member_join event, it takes a member object and that's all you need

#

member

#

if it's a guild it's a member

#

yes

#

why do you want a role id?

#

ok

ruby dust
#

this is still async right?

#

pulls out async docs

#

it's definitelly not the way you did it

#

in order to assign a role, you first need to get the role, luckily discord.py has a built-in function for that

#

you need to use discord.utils to find the role, and then assign the found role

#
@bot.event
async def on_member_join(member):
    role = discord.utils.get(ctx.message.server.roles, name = 'Members')
    await bot.add_roles(member, role)
#

member.server.roles

#

¯_(ツ)_/¯

abstract crystal
#

*questions why d.py async still exists*

merry stirrup
#

Can someone help me. I tryed to host my bot on Heroku but this error gets up:

Error: Cannot find module 'Discord.js'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/app/index.js:1:79)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
inner jewel
#

try require("discord.js")

#

with a lowercase d

merry stirrup
#

trying atm

#

thx!

#

Working

merry stirrup
#

Is it smart to start running my bot on heroku?

trim plinth
#

no you'd rather get a VPS

#

but if you have no pocket money to invest into VPS, its better than selfhosting

merry stirrup
#

ok

earnest phoenix
#

what's happening here?

inner jewel
#

invalid json

earnest phoenix
#

?

inner jewel
#

your config is corrupted

earnest phoenix
#

literally how

#

has 4 lines of code

#

welp, time to make anoither

trim plinth
#

show the JSON code

earnest phoenix
#

{
"token": "XXX"
"prefix": "»"
"owner": "Astora#7539"
}

inner jewel
#

missing commas

trim plinth
#

^

earnest phoenix
#

there was commas and it just complained

#

I removed em thinking they mihgt be the issue

trim plinth
#

just make sure that there is commas after token and prefix

earnest phoenix
#

there's witht eh commas

trim plinth
#

uhh your token

earnest phoenix
#

well done

trim plinth
#

might want to reset that

earnest phoenix
#

this is why I was using a config

#

show us code again but without your token

trim plinth
#

show the config code without the token

earnest phoenix
#

{
"token": "NDI4MNDI4MNDI4MNDI4MNDI4MNDI4M",
"prefix": "»",
"owner": "Astora#7539"
}

trim plinth
#

hmm

earnest phoenix
#

...

#

isn’t that his old en

prime cliff
#

Putting your ownername in config instead of getting it automatically and then your discrim/name changes

trim plinth
#

¯_(ツ)_/¯

floral stone
#

userid is better

weak parrot
#

Yeah

earnest phoenix
#

not gonna change my name

#

if I do, future me doesn't deserve to use the bot.

#

no Thonk

prime cliff
#

Ok then thats a deal

earnest phoenix
trim plinth
#

yeah but somebody else could change their name and discrim to that

prime cliff
#

No changing your name or you delete your bot

trim plinth
#

so id is better

prime cliff
earnest phoenix
#

someone could take my id too

trim plinth
#

no

prime cliff
#

No IDs are unique

earnest phoenix
#

they'd have to be a discord employee though

#

inside job and all

trim plinth
#

no they can't change it either

earnest phoenix
#

they can

trim plinth
#

and they have no reason to

earnest phoenix
#

(((they))) can

#

overthinker

trim plinth
#

@earnest phoenix (((they have no reason to)))

prime cliff
#

@earnest phoenix You seem to know alot about the inside job of Discord are you a spy zoomeyes

earnest phoenix
#

I'm a spy for the enemy yes

#

Skype Squad unite!

prime cliff
#

Oh god

earnest phoenix
#

(((if they stole anything it would be @gilded plank token)))

floral stone
#

They will change it, we know nothing. Go ahead and make a fool out of your code.

#

Good luck!

earnest phoenix
#

»Implying I'm not joking

#

I'd tell you to go ahead and make a fool of yourself but you already did.

#

atleast look for a tutorial for something that simple before asking us

#

yeah I did

trim plinth
#

hmm I'd say you are making a fool of yourself with that flopped comeback GWbowsuBlobThonkeng

earnest phoenix
#

literally copypasted that from the tutorial when it first went to shit to make sure it wasn't the problem

#

copypasta

#

wow 10/10

floral stone
#

I was being sarcastic ya thot

earnest phoenix
#

jokes on you I barely understood what you said

floral stone
#

Original code > copypasta

earnest phoenix
#

anyday^

inner jewel
#

my bot is full of copypasta

#

90% of my music commands are copypasta

#

!!!!!!

floral stone
#

Jokes on you, you barely understood anything I said.

earnest phoenix
#

copypasting code > refusing to copy and paste code when things go wrong just to make sure that that file isn't the issue

floral stone
#

Copypasta isn't a bad thing, it's just original code is better.

earnest phoenix
#

I have been doing original shit when I think of it

#

tbh he is on about config.json but still original code > copypasta

#

but I'm using this tutorial to learn the ins and outs, and straying too far from the guide too early on makes later parts incompatible

#

»deleted all my config files

#

»made config.json again

#

»it works

#

the fuck

floral stone
#

no it doesn't

#

nothing works when you are filled with insecurities

earnest phoenix
#

it just werks

trim plinth
#

un-customized powershell with that bright ass blue GWmythsBlobGlare

earnest phoenix
#

customised?

#

I thought that was a linux thing

trim plinth
#

yes

karmic parcel
#

builder, you almost had me

floral stone
#

get a better terminal

karmic parcel
#

boi

earnest phoenix
#

powershell > cmd

trim plinth
#

you right click on the window thingy and click properties to change the color GWkazuOwO

#

its beautiful

karmic parcel
#

terminal > powershell || cmd

trim plinth
#

^

floral stone
#

They all do the same shit tbh but terminal ssh is the best

inner jewel
#

terminal > cmd > powershell

karmic parcel
#

aw man, my pi zero is gonna take forever to update

#

reeee

trim plinth
#

terminal GWowoBlobCoffee

inner jewel
#

cmd at least opens in less than a minute

#

unlike powershell

earnest phoenix
#

consolas or lucida console ofr typeface?

trim plinth
#

lul

floral stone
#

neither

#

just burn it

trim plinth
#

use cmd like a normie

#

or terminal

earnest phoenix
#

fuck it, consolas

#

lucida is too wide

#

gotta make me my own typeface, I hate them all

#

okie dokie

floral stone
terse badger
#

Lmao windows

earnest phoenix
#

sweet thanks @trim plinth

trim plinth
#

np GWbowsuBlobThinkOwO

earnest phoenix
#

@floral stone font =/= typeface

floral stone
#
    print("whatever")```
terse badger
#

This mans got it all

#

!owo image recall wheeze

#

Damn no bots allowed here

karmic parcel
#

I need to fix my font

#

riperonis

terse badger
#

Same

#

But effort and time

earnest phoenix
#

»javascript

#

pleb

#

if $typefacedefinition != "font ? "whatever

trim plinth
#

hmm I wonder if I can customize my VSC terminal font, or theme font in the theme settings GWchadThink

terse badger
#

@trim plinth you can

trim plinth
#

wew

terse badger
#

The first for sure. You can then change the editor font

earnest phoenix
#

@floral stone can you name the languaghe?

terse badger
#

Regardless of theme

trim plinth
#

@earnest phoenix thats python

floral stone
#

no its not

trim plinth
#

not js

floral stone
#

looks like lua

earnest phoenix
#

nope

trim plinth
#

no I'm talking about the code snippet you did

inner jewel
#

it's not

#

lua uses ~= and there's no ternary

earnest phoenix
#

I'll do more and tell me what you think it is

terse badger
#

Thats not ternary

inner jewel
#

or w/e

#

lua doesn't use ?

trim plinth
#

thonkers

#

anyways I'm re-learning Java again, hopefully I'll actually remember how to use it

earnest phoenix
#

AAAAAAAAAAAAAA

#

I JUST DROPPED A CPU AND I DON'T KNOW WHERE IT WENT

trim plinth
#

ok™

earnest phoenix
#

found it

#

~1 meter fall and no pins bent

uncut slate
#

not really the appropriate channel 👀

earnest phoenix
#

sorry was just typing something here then it happnened

earnest phoenix
#

hey

#

since im not goot with js

vital lark
#

goot

earnest phoenix
#

can someone help me with picking a random image from a folder?

#

i mean, i write "fly random ship" and it sends a random ship pic

#

(from a folder)

elder rapids
#

math.random

trim plinth
#

Math.random and Math.floor

vital lark
#

myVar[Math.floor(Math.random() * myVar.length))];
const myVar = require('./folder/file.json');

trim plinth
#

you would do it above the Math.floor or it'll return undefined

elder rapids
#

Wait was I actually close to correct?

trim plinth
#

yes

#

you were

earnest phoenix
#

@vital lark can u explain please?

vital lark
#

maybe owo

elder rapids
#

Well its capital math

#

Close

earnest phoenix
#

i need to create an array of images?

trim plinth
#

no

#

yes

earnest phoenix
#

yes

vital lark
#

yes

trim plinth
#

maybe

earnest phoenix
#

how do i do that?

#

can i learn that power?

elder rapids
#

Shitpost you weebs if you gonna do that

earnest phoenix
#

fs

trim plinth
#

You should know how to make an array

terse badger
#

Learn how 2 think

earnest phoenix
#

im new to js, so sorry, i dont know

terse badger
#

This isnt a js specific problem

earnest phoenix
#

g00gel "how to get all files in directory" js

trim plinth
#

learn js before making a js bot™

terse badger
#

You think abour how you would deal with the problem step by step, and then you google how to do each step

earnest phoenix
#

if i asked for halp it means i dont know

terse badger
#

Ifyou cant find an answer to a step, then it hasnt been broken down enough

elder rapids
#

That requires they understand the concept of problem solving

vital lark
#
[
    "myimage"
]
const myVar = require('./folder/file.json'); // folder is the folder and file is your file
console.log(`${myVar[Math.floor(Math.random() * myVar.length)]}`);
trim plinth
#

augu ya spoonfeed

earnest phoenix
#

oof thats in a json file

elder rapids
#

no u

earnest phoenix
#

he wanted all files out of a directory

terse badger
#

@earnest phoenix then deduce how to

earnest phoenix
#

._.

#

im 13 years old

#

and ur not helping

elder rapids
#

Why's that matter

terse badger
#

Irrelevant

elder rapids
#

^

earnest phoenix
#

ur still not helping, thx

#

g00gel

terse badger
#

We're helping you to help yourseld

vital lark
trim plinth
#

@earnest phoenix august just gave you the code, how do you still not understand

earnest phoenix
#

thatss a nice solution, thx

terse badger
#

So you require less spoonfeeding in the future

elder rapids
#

The rules even state we don't spoonfeed

earnest phoenix
#

catch a fish for a man, he will have fish for a day

terse badger
#

If we just throw you the code, you wont learn too well

earnest phoenix
#

teach a man to fish, he will have fish for the rest of his life

elder rapids
#

Wise words

#

Actual true statement

terse badger
#

This exactly

#

Learn how to break down a problem into small steps

earnest phoenix
#

.-.

#

._.

terse badger
#

Each of those steps should be easily googlable

vital lark
earnest phoenix
#

THATS A SOLUTION

#

FINALLY

vital lark
earnest phoenix
#

GOOGLE UP

terse badger
#

@vital lark leave

trim plinth
#

@vital lark no u

terse badger
#

Cant tell if taxi is being sarcastic rn

earnest phoenix
#

be nice

terse badger
#

🤔

#

To who

#

Right anyways

earnest phoenix
#

._.

#

srsly

terse badger
#

Your problem broken down:

earnest phoenix
#

no u

#

u said same 100 times already

trim plinth
terse badger
#

Get a list of all images in a folder
Choose a random element of the list

#

Success

#

Then further break down those problems

earnest phoenix
#

in 99% of cases you should be googling it

#

if you don't find an answer ask somewhere

#

i have that even in a notebook already

#

somebody, somewhere has had the same issue as you

trim plinth
#

listen to what they are saying and maybe you'll get the answer with the help of your friend google GWnanamiKonataThumbsUp

earnest phoenix
#

and yes, i know how to learn alone

#

and i began learning yesterday

terse badger
#

You have what in a notebook

earnest phoenix
#

the solution

terse badger
#

🤔

earnest phoenix
#

for dumbs: block scheme

terse badger
#

Then google each of the steps

#

Combine together

#

Success

trim plinth
#

just a question, why are you making a js bot if you don't know js well enough GWfroggyAngryEyes

terse badger
#

^

earnest phoenix
#

cuz

#

it looks easy

trim plinth
#

no it isn't

earnest phoenix
#

so i make XD

terse badger
#

It isnt reeally

earnest phoenix
#

for me it is

terse badger
#

Clearly not?

earnest phoenix
#

.-.

trim plinth
#

JS may be easy but you can't run straight into it if you have no idea what you are doing

elder rapids
#

Making a bot is a lot harder than you think

earnest phoenix
#

if i say it is you dont have to add things to what i said

elder rapids
#

It looks simple when you just have a few servers with simple ping pong style commands

terse badger
#

Why you having issues when you say its easy

#

Which is it

earnest phoenix
#

because all programming language can have different structures

terse badger
#

What has languages got to do with it

earnest phoenix
#

for example 12+12 in binary and in trinary numeric system is different

terse badger
#

And?

#

Your point is?

earnest phoenix
#

my point is that a solution for a problem may be the same but the sintaxis is different

#

**NOW U GET IT???**

terse badger
#

Anyone else not get what hes saying here and how it's relevant?

earnest phoenix
#

stop exposing me to others

terse badger
#

🤔 🤔 🤔

earnest phoenix
#

analise it by urself

trim plinth
#

anal-lise

#

yes

terse badger
#

Wheeze

earnest phoenix
#

u tell me the same

#

thx @trim plinth

trim plinth
#

that wasn't siding with you

terse badger
#

If youre having issues getting a random image from a folder, but dont have issues making a moderately complex bot

#

You got a problem

earnest phoenix
#

for correcting my grammar .-.

terse badger
#

Okay lets get back to square one

#

You have the steps laid out

#

Wheres the issue

earnest phoenix
#

if you dont have the capability to accept that its not ur problem, then dont get inside it

terse badger
#

🤔

#

Do you want help or not kid

earnest phoenix
#

i dont need

terse badger
#

Then bye

#

?

earnest phoenix
#

ive actually finished already

#

on processin

#

now converting to js