#Github Commit Embed bot

726 messages · Page 1 of 1 (latest)

cobalt beacon

as you can see by the pictures i want to know how hard it is to make a github webhook bot like there one as the one with green you can add a description etc and it’s all custom and it’s a actual discord bot, however my one is obviously just a standard webhook, if i could have any help and increase my knowledge on this that’d be great, thank you!

on the github i want to be able to change the embed to the left as i can have a description + custom name + a different hex color on the left and it stands out more

but still putting my commits out as usual

any helps appreciated

cobalt beacon

top is basic webhook

bottom is what i want mine like :)

sullen idol

in the Webhooks page of settings in your repo, you can specify a webhook url

github sends a POST request to the specified url

which you can then format however you want

burnt vale

@cobalt beacon Hey, I got interested in this and thought I would give it a go, I think I managed to do it. Have you got anywhere?

cobalt beacon
burnt vale

Are you using express?

cobalt beacon

no

burnt vale

what are you using then

cobalt beacon

what do you mean

im a bit confused lol

burnt vale

Did you not get anything done on it lol

cobalt beacon

im ngl i gave up tryna find stuff as im very new to js and this is basically the only thing i need done with it tbh

i mainly use Lua

burnt vale

Fair lol, I'm in a good mood so I can guide you if you want

cobalt beacon
burnt vale

Yh yh ofc, I'll send it all

you wanna install express though

so npm i express

cobalt beacon

question

where do i put that 😭

burnt vale

are you using vs code? it'll be in the terminal

cobalt beacon

yeah

burnt vale

this may get a bit difficult if you couldn't do that part lol

cobalt beacon

nah i tried it

and it gave a error

burnt vale

show

cobalt beacon

so i gave up haha

lemme open rq

burnt vale

if you get any errors just show them lol

cobalt beacon

alright lemme make a new file

burnt vale
cobalt beacon
burnt vale

oh you don't have it installed

do you have node js installed?

cobalt beacon

nop

ill download rq

rapid nicheBOT
burnt vale

oh

not that

cobalt beacon

this?

burnt vale

no no

cobalt beacon

oh

burnt vale

get the current one ig lol

or

one secon

cobalt beacon

did you host your github pushs with through developer portal?

burnt vale

go here

cobalt beacon

yah

burnt vale

and then come to this part

and download the exe file

nvm is node version manager

it's great for installing node

burnt vale
cobalt beacon

oh alright

downloaded both

burnt vale

open up cmd

cobalt beacon

ya

burnt vale

idm showing my name, but

open the nvm.exe

run it

then run nvm -v

cobalt beacon

ya

burnt vale

cool

then

nvm installl v20.0.0

I think

cobalt beacon

alot of stuff came up

burnt vale

show

it should have done it

cobalt beacon
burnt vale

yh lol

nvm install 20

it'll install v20.3.0

I think

cobalt beacon

yeah

burnt vale

the latest one anyway

oh

cobalt beacon

already done

burnt vale

cool

cobalt beacon

yeah

burnt vale

now just make a new folder and drop that into vs code

cobalt beacon

drag what into vsc?

burnt vale

the new folder lol

or do you have vs cod open

code*

cobalt beacon

yeah

i got it open

burnt vale

oh cool lmao

ok open terminal

npm -v

cobalt beacon

it returned 9.6.7

burnt vale

coolio

npm i express

cobalt beacon
burnt vale

err

do you have any like, restrictions on your system

cobalt beacon

uh no

should i start vsc in administrator/

burnt vale

try thayt yh

that

cobalt beacon

okay

done

burnt vale

ok err

give me a second

cobalt beacon

okay

burnt vale
const express = require("express");
const app = express();
app.use(express.json());
app.post('/github', async (req, res) => {
    console.log('emitted!');
    console.log(req.body);
});

Paste that

in index.js

make a file called that ofc lmao

burnt vale
cobalt beacon

i opened exe

now what

burnt vale

it's installed?

cobalt beacon

oh

right

yeah

burnt vale

cool

now i need to remember how ngrok works lmaooo

cobalt beacon

lol

burnt vale

app.listen(80, () => console.log('listening at port 80'))

cobalt beacon

like that?

burnt vale

yh

cobalt beacon

ok

burnt vale

now do node .

node .

any errors?

cobalt beacon

in terminal yeah?

burnt vale

yh

cobalt beacon
burnt vale

oh

inside vs code lol

cobalt beacon

that is

have i done it wrong?

burnt vale

do node index.js

cobalt beacon

like that?

burnt vale

err

move that folder into ur desltop or somthing

can't type

cobalt beacon

in desktop same thing

burnt vale

what...

show the left handside

cobalt beacon
burnt vale

yh

drag index.js out of help

you can then delete that folder

you should have opened it like inside the main folder

will look like that then

cobalt beacon

what is that from though?

burnt vale

what is what from

cobalt beacon

all the folders

are they yours or was i meant to have them

burnt vale

oh they're mine

cobalt beacon

sorry im abit slower when it comes to new things

oh right

burnt vale

I use them ofr other stuff lol

cobalt beacon

yeah

so its just a file on my desktop now

lemme try to run it

nope

burnt vale

errr

ok err

is that index.js just on your desktop as a gile?

cobalt beacon

yeah

burnt vale

make a new folder called like

my project

drag and drop index.js into that folder

new window of vs code, close the other one

cobalt beacon

in any specific folder

burnt vale

then drag and drop that folder

cobalt beacon

can i put it in documents

inside a folder of course?

burnt vale

it doesn't matter where it is just make sure index.js is in a foldeer

then drag then folder into vs code

but a new window

cobalt beacon

yeah

samething

burnt vale

is it saved?

😭

what...

oh

npm init

cobalt beacon
burnt vale

yh just spam enter

then npm i express again

cobalt beacon

done

burnt vale

show me the left hand side again

cobalt beacon
burnt vale

ok

now node index.js

cobalt beacon

lol

burnt vale

what...

i don't understand that

cobalt beacon

may i have installed something wrong?

burnt vale

that makes no sense

this works for me just fine

make a new folder called project again

a new empty folder

cobalt beacon

yeah

burnt vale

new window

then open folder

and choose that folder you just made

cobalt beacon

yeah

burnt vale

in it

?

show me

cobalt beacon
burnt vale

why do you have that at the top

cobalt beacon

fresh

what?

burnt vale

idk

err

npm init

spam enter

npm i express

cobalt beacon
burnt vale
const express = require("express");
const app = express();
app.use(express.json());
app.post('/github', async (req, res) => {
    console.log('emitted!');
    console.log(req.body);
});

app.listen(80, () => console.log('listening'))
cobalt beacon

made

done

burnt vale

now try?

istf if it doesnt

cobalt beacon

what

burnt vale

?

cobalt beacon

whats that

burnt vale

what did you do

cobalt beacon

lemme redo this rq

there?

idk what its on about

maybe i try a different folder name?

burnt vale

oh

dpam enter

spam

lol

cobalt beacon

oh yeah

done

burnt vale

then npm i express lol

cobalt beacon

yeah

then index .js

the file

burnt vale

yh make index.js

then poat the code

post

cobalt beacon

correct so far?

burnt vale

oh

great lol

in your terminal

type

ngrok http 80

cobalt beacon

it doesnt let me type

burnt vale

ctrl c lol

cobalt beacon

oh yeah

i open e

opened ngrok tho?

burnt vale

hmnm

cobalt beacon

any ideas?

burnt vale

Yh hold on

cobalt beacon

ok

burnt vale

err

ok err

In cmd type ngrok http 80

cobalt beacon

so command prompt

not terminal

burnt vale

Yh try

cobalt beacon
burnt vale

Did you not install it

cobalt beacon

i opened the exe?

this right?

burnt vale

Yh

Mine wouldn’t install properly either

Idk if it’s antivirus or some shit

cobalt beacon

yeah

burnt vale

Oh it works

Sick

ngrok http 80

cobalt beacon

what do i do

wat

burnt vale

Close that cmd

Open another with administrative perms

cobalt beacon

ok

burnt vale

what

i don't get it at all 😭

cobalt beacon

haha

do i really need all this just for this bot?

if so i would of never been able to do it

burnt vale

you'll use ngrok to get a https link for your post requests

cobalt beacon

ohhh

so once this works

i can drag it onto my vps

as that will be where it will be

for it all

burnt vale

you have a vps?

💀

cobalt beacon

yeah

for my fivem server

burnt vale

you could have said it would've made this easier

cobalt beacon

oh

mb

burnt vale

is it ubuntu/

?*

cobalt beacon

no

burnt vale

make a git repo

og

cobalt beacon

windows

burnt vale

oh

L windows

do you have your own website or something

cobalt beacon

its a fivem server

burnt vale

actually nvm idk how to set that tuff up

stuff

cobalt beacon
burnt vale

nvm

cobalt beacon

how does your github bot look btw

burnt vale

I haven't sorted it out fully yet

cobalt beacon

does it have description and stuff?

burnt vale

I just got this stuff working

I haven't got anything else working yet

cobalt beacon

have you tried it out

burnt vale

It's easy now

cobalt beacon

liike in discord

burnt vale

I've got what I need

cobalt beacon

to see how it looks

burnt vale

I can just make it how I want

cobalt beacon

so you could make it exactly like this

the bottom one

burnt vale

I could if I wanted to yh

you just gotta find what each part means

cobalt beacon

well most of it is just a basic webhook

the bottom part is just the description

and then its got a footer

and obviously the color on left

so what do i do from now

burnt vale

idk why ngrok refuses to install

cobalt beacon

yeah

neither

do i need to make a ngrok account?

could that be why?

burnt vale

tbh like, I don't think I can help you further

As I use my own website you see

cobalt beacon

yeah

but lemme try this

burnt vale

that died

cobalt beacon

OH

cobalt beacon

@burnt vale

ive got it working

burnt vale

I did see lol

Just you got that part working but I can’t get the rest

I don’t think I’d be able to help much more

cobalt beacon

what actaully am i missing?

burnt vale

I use my website so all post requests get directed there

Idk how to do it with ngrok

cobalt beacon

can i not just use discord instead?

burnt vale

I got it working

but it's not good code

you're gonna wanna

npm i ngrok

in vs code

const express = require("express");
const app = express();
const ngrok = require('ngrok');

let url;
(async function() {
    url = await ngrok.connect(80);
    console.log(url)
})();
app.use(express.json());
app.post('/github', async (req, res) => {
    res.send(200)
    console.log('emitted!');
    console.log(req.body);
});

app.post('/', () => {
    console.log('post')
})
app.get('/', () => {
    console.log('gi')
})
app.listen(80, () => console.log('listening on port 80'))

This is the new code

cobalt beacon
burnt vale

yh

cobalt beacon

what next

burnt vale

node index.js

cobalt beacon

yeah

its worked

now

what

burnt vale

you copy that link

got to github

repository settings

webhooks

add the webhook

but put /github at the end

then update

cobalt beacon

like that then yeah?

not putting my ip obvs

burnt vale

yh update

then like star ur repo or something see if anything logs in ur terminal

cobalt beacon

yeah

starred it

anmd that happened

cobalt beacon

yeah

burnt vale

no idea then

cobalt beacon

heres what it is

const express = require("express");
const app = express();
const ngrok = require('ngrok');

let url;
(async function() {
    url = await ngrok.connect(80);
    console.log(url)
})();
app.use(express.json());
app.post('/github', async (req, res) => {
    res.send(200)
    console.log('emitted!');
    console.log(req.body);
});

app.post('/', () => {
    console.log('post')
})
app.get('/', () => {
    console.log('gi')
})
app.listen(80, () => console.log('listening on port 80'))```

will this work for sending to discord

?

imma head to sleep

if you get any further

please let me know as ive been looking to maek this for a few days now

thanks

cobalt beacon
burnt vale
cobalt beacon
burnt vale

I can’t really help you further as I don’t have the knowledge on that part

burnt vale

Something like that yh

Would be easier if yoy had your own website or something but I have no idea how to fully set that stuff up

cobalt beacon

why? is ngrok not really too good for discord or something?

burnt vale

Well without an account and probably a subscription it’s gonna end in 2 hours as each session is 2 hours long

cobalt beacon

im asking a person who done it

and he said wtf is ngrok

so there must be some other way to do without ngrok

burnt vale

Maybe you can just use http then

because then it’ll be http://ur_server_ip:the_port

cobalt beacon

however im not going to sit here and say i know how to do that though

as i did try this and didnt really get far to be honest

burnt vale

The issue I have is the link, the webhook url yoy give to github to send the post request

As I said, I just use my webhook

Website*

cobalt beacon

yeah

burnt vale
cobalt beacon

yeah that nice

i just need one like that of course

then i can sort out the embed

cobalt beacon

just has the big description box underneath

cobalt beacon
burnt vale

by the wya would that github webhook bot do the whole channel as

every repository he has in that channel which is around 8 has that bot

or would he of manually added all the webhooks

cobalt beacon

@sullen idol you got any ideas?

sullen idol

huh

ngrok has a "confirmation page"

when github tries sending to ththje page you specified, it goes to the confirmation page instead, so you dont get the request

cobalt beacon

i need it to go discord

sullen idol

what

you don’t receive what GitHub sends because it goes to the ngrok confirmation page

cobalt beacon

is waht o want it to look like

burnt vale

I find you what to do though

Told*

cobalt beacon
burnt vale

Ok?

So, did you get the other stuff working?

cobalt beacon

what stuff?

burnt vale

Run it, get the url pop that into github

cobalt beacon

yeah

i got it to there

and i said what more ?

burnt vale

put at the end of the url /github

cobalt beacon

and you said you dont know any furthur

since you use a website

burnt vale
cobalt beacon

let me find where i stored this

cobalt beacon
burnt vale

And?

cobalt beacon

so what did i need to do furthur from here?

should i try this with a tester repository

burnt vale

run it

cobalt beacon

i need to get the ngrok webhook

as imma try with different repositor

y

burnt vale

Bruh no

did you run uit?

it*

cobalt beacon

so what npm start run?

burnt vale

node .

node index.js

either or

cobalt beacon

connection refused

burnt vale

Sounds like an issue with ur system

cobalt beacon

should i try this on a vps?

to see if it works on there?

burnt vale

upload it there yh

cobalt beacon

alright gimme a moment

make a new file dont just copy and paste?

or will copy and paste be fine

burnt vale

What?

cobalt beacon

make a new index.js and copy the writing in

or

copy and paste from my pc into my vps

burnt vale

you can copy that code if you want

just gotta install the other stuff too

cobalt beacon

yeah ikik

alright

now its saying listening

from node .

so now do node index.js

cobalt beacon
burnt vale
cobalt beacon

yes it has

burnt vale

copy it

cobalt beacon

done

burnt vale

go to github

go to the repo

webhooks

cobalt beacon

done

ap

burnt vale

paste that url but put /github at the end, should be something like
... .io/github

cobalt beacon

application json yeah?

burnt vale
cobalt beacon

send me everything yeah

burnt vale

yh

cobalt beacon

done added

cobalt beacon
burnt vale

Or, check ur console.log

it should have logged something

if not

burnt vale
cobalt beacon

ive tried to redeliver

and its gave a error

burnt vale

ur console.log?

cobalt beacon

nothing here

burnt vale

well it's not even running there bro 💀

cmon now

cobalt beacon

it is

burnt vale

where then

cobalt beacon

there

its saying same thing now

burnt vale

you need to keep it running

this is the issue you'll have with ngrok

cobalt beacon

oh it did change yeah

shit

burnt vale

idk how else to do it

cobalt beacon

on my vps itll be fine tho

ill just leave it open ig

burnt vale

Use pm2, or leave a cmd tab open

cobalt beacon

now ive done it right

and its still got a error?

burnt vale

did you redeliver, change /github at the end?

cobalt beacon

do i need xampp?

burnt vale

who?

burnt vale
cobalt beacon
burnt vale

dd anything log in the terminal

cobalt beacon

nothing

do i need to do node . and node index.js

or just one?

burnt vale

they'll do the sme thing

same

cobalt beacon

oh right

its printed that

idk what that is

burnt vale

That was a get request

Did you put that url in ur browser or something?

cobalt beacon

yes

so if that works how isnt the github webhook working

i asked the guy who had it

and he said this to me

burnt vale

app.get() handles get requests

cobalt beacon

used js listened to a port and on github webhook post the payload to the port then got the info put in embed and put it in the channel

burnt vale

app.post() handles post

cobalt beacon

thats how he told me to do this

burnt vale

it's not as easy as just
"put port"!
"put stuff"
"done"!!

cobalt beacon

thats what i was thinking

burnt vale

Same url

cobalt beacon

yeah

burnt vale

what are you using ro run it

to

cobalt beacon

wym

?

terminal on vsc

burnt vale

open cmd as admin

cobalt beacon

done

burnt vale

then cd into that folder

cobalt beacon

C:\Users\Barns\Desktop\new project

thats my thing

so put that in cmd?

burnt vale

no

cd into it

cobalt beacon

oh

cd idk what that is

burnt vale

type dir

cobalt beacon

wtf

alot of stuf

burnt vale

dir means directory

cobalt beacon

yeah

burnt vale

cd ./Desktop

cobalt beacon
burnt vale

D

not

d

idk where you are so it's a bit hard

cobalt beacon
burnt vale

cd ..

cd ..

cobalt beacon
burnt vale

no

cd ..

rapid nicheBOT
  • File paths explained in detail: learn more
  • . refers to the current directory
  • .. refers to the parent directory
  • Node path module: learn more
cobalt beacon

and paste

burnt vale

just type

cd

with two dots, right after the other

cobalt beacon

okay

burnt vale

cd ./Users/Barns

cobalt beacon
burnt vale

cd ./Desktop

cobalt beacon

yah

burnt vale

cd ./new project

cobalt beacon
burnt vale

node index.js

copy new url, paste into github, add /github at the end

It also works just fine for me

cobalt beacon

its worked

burnt vale

you would have got a tonne of info

cobalt beacon

yep

burnt vale

const event = req.headers['x-github-event']; that's the event

you can read what each event does, and what it sends

cobalt beacon

yeah

so

do i put const event = req.headers['x-github-event'];

in here

burnt vale

inside of the app.post

however I think ngrok only works for 2hours on the free version

I'm not too sure

cobalt beacon

like that?

btw the person who made his

said this

i used js and github

barnsy — Today at 19:39
so nothing else at all?

Bentheborg — Today at 19:39
nope

burnt vale
app.post('/github', async (req, res) => {
    res.send(200)
    const event = req.headers['x-github-event'];
    if(event == 'commit') {
        web.send(stuff)
    }
})

web you can use djs if you want

cobalt beacon
app.post('/github', async (req, res) => {
    res.send(200)
    console.log('emitted!');
    console.log(req.body);
});

app.post('/', () => {
    console.log('post')
})```

which one does it go in sorry?

no

got it

burnt vale
cobalt beacon

yeah

burnt vale
cobalt beacon

ya

burnt vale

that handles everything coming from the github

cobalt beacon

got it

alright

burnt vale

you can stop the cmd, type
npm i discord.js

Make a new webhook url

in discord

burnt vale
const web = new WebhookClient({
  url: <that url>
})
web.send()
cobalt beacon
stark iris

leaking dms now not good

cobalt beacon

wys

cobalt beacon
stark iris

whats ur issue with it

burnt vale

again, as I told you before, I'm using my website. I don't really know other ways to do it

I know this is a way

cobalt beacon

and @burnt vale is helping

cobalt beacon

however gwapes has a website where his goes to

cobalt beacon

im guessing you helped cnr with his tho

not sure shrug

cobalt beacon

lol

im just trying to make one like it 😄

burnt vale

if you aren't gonna help then why are you even here?

stark iris

pretty sure tho he asked me for help first

so 👍🏿

burnt vale

Well off you pop then

burnt vale

Good luck

stark iris
burnt vale

Good for you ig?