Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Remilia Scarlet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Reviath
Remilia Scarlet
Commits
f02d4694
Commit
f02d4694
authored
May 18, 2021
by
Reviath
Browse files
Options
Downloads
Patches
Plain Diff
Deleted ClientID from config, getting user id with @me method.
parent
41c1fffd
No related branches found
No related tags found
No related merge requests found
Pipeline
#680
passed
May 18, 2021
Stage: build
Changes
5
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
config.json
+0
-1
0 additions, 1 deletion
config.json
config/config.go
+0
-3
0 additions, 3 deletions
config/config.go
main.go
+1
-1
1 addition, 1 deletion
main.go
web/cli.go
+1
-12
1 addition, 12 deletions
web/cli.go
web/web.go
+1
-1
1 addition, 1 deletion
web/web.go
with
3 additions
and
18 deletions
config.json
+
0
−
1
View file @
f02d4694
...
@@ -9,6 +9,5 @@
...
@@ -9,6 +9,5 @@
"Password"
:
"PASSWORD"
,
"Password"
:
"PASSWORD"
,
"Host"
:
"HOST"
,
"Host"
:
"HOST"
,
"WebURL"
:
"WEB_URL"
,
"WebURL"
:
"WEB_URL"
,
"ClientID"
:
"CLIENT_ID"
,
"ClientSecret"
:
"CLIENT_SECRET"
"ClientSecret"
:
"CLIENT_SECRET"
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
config/config.go
+
0
−
3
View file @
f02d4694
...
@@ -18,7 +18,6 @@ var (
...
@@ -18,7 +18,6 @@ var (
Password
string
// Password to connect MySQL database
Password
string
// Password to connect MySQL database
Host
string
// Host to connect MySQL database
Host
string
// Host to connect MySQL database
WebURL
string
// WebURL to run website
WebURL
string
// WebURL to run website
ClientID
string
// ClientID to use on website
ClientSecret
string
// ClientSecret for OAuth2
ClientSecret
string
// ClientSecret for OAuth2
)
)
...
@@ -33,7 +32,6 @@ type configStruct struct {
...
@@ -33,7 +32,6 @@ type configStruct struct {
User
string
`json:"User"`
// User from config file
User
string
`json:"User"`
// User from config file
Password
string
`json:"Password"`
// Password from config file
Password
string
`json:"Password"`
// Password from config file
WebURL
string
`json:"WebURL"`
// WebURL from config file
WebURL
string
`json:"WebURL"`
// WebURL from config file
ClientID
string
`json:"ClientID"`
// ClientID from config file
ClientSecret
string
`json:"ClientSecret"`
// ClientSecret from config file
ClientSecret
string
`json:"ClientSecret"`
// ClientSecret from config file
}
}
...
@@ -63,7 +61,6 @@ func ReadConfig() error {
...
@@ -63,7 +61,6 @@ func ReadConfig() error {
Password
=
config
.
Password
Password
=
config
.
Password
LoadInteractions
=
config
.
LoadInteractions
LoadInteractions
=
config
.
LoadInteractions
WebURL
=
config
.
WebURL
WebURL
=
config
.
WebURL
ClientID
=
config
.
ClientID
ClientSecret
=
config
.
ClientSecret
ClientSecret
=
config
.
ClientSecret
return
nil
return
nil
...
...
This diff is collapsed.
Click to expand it.
main.go
+
1
−
1
View file @
f02d4694
...
@@ -15,7 +15,7 @@ import (
...
@@ -15,7 +15,7 @@ import (
func
main
()
{
func
main
()
{
config
.
ReadConfig
()
config
.
ReadConfig
()
if
config
.
Token
==
"TOKEN"
||
config
.
ClientID
==
"CLIENT_ID"
||
config
.
ClientSecret
==
"CLIENT_SECRET"
||
config
.
WebURL
==
"WEB_URL"
{
if
config
.
Token
==
"TOKEN"
||
config
.
ClientSecret
==
"CLIENT_SECRET"
||
config
.
WebURL
==
"WEB_URL"
{
fmt
.
Println
(
"Edit config file before running."
)
fmt
.
Println
(
"Edit config file before running."
)
os
.
Exit
(
1
)
os
.
Exit
(
1
)
}
}
...
...
This diff is collapsed.
Click to expand it.
web/cli.go
+
1
−
12
View file @
f02d4694
package
web
package
web
import
(
import
(
"fmt"
"os"
"time"
"git.randomchars.net/Reviath/RemiliaScarlet/config"
"github.com/bwmarrin/discordgo"
"github.com/bwmarrin/discordgo"
)
)
// GetClientUser returns to Bot's owner as *discordgo.User
// GetClientUser returns to Bot's owner as *discordgo.User
func
GetClientUser
(
session
*
discordgo
.
Session
)
*
discordgo
.
User
{
func
GetClientUser
(
session
*
discordgo
.
Session
)
*
discordgo
.
User
{
cli
,
err
:=
session
.
User
(
config
.
ClientID
)
cli
,
_
:=
session
.
User
(
"@me"
)
if
err
!=
nil
{
fmt
.
Println
(
"An error occurred while getting client user on web panel (please be sure that you wrote ClientID correct)"
)
time
.
Sleep
(
1
*
time
.
Second
)
fmt
.
Println
(
err
.
Error
())
os
.
Exit
(
1
)
}
return
cli
return
cli
}
}
This diff is collapsed.
Click to expand it.
web/web.go
+
1
−
1
View file @
f02d4694
...
@@ -77,7 +77,7 @@ func Listen(session *discordgo.Session) {
...
@@ -77,7 +77,7 @@ func Listen(session *discordgo.Session) {
})
})
server
.
GET
(
"/invite"
,
func
(
c
*
gin
.
Context
)
{
server
.
GET
(
"/invite"
,
func
(
c
*
gin
.
Context
)
{
c
.
Redirect
(
http
.
StatusTemporaryRedirect
,
fmt
.
Sprintf
(
"https://discord.com/oauth2/authorize?client_id=%s&scope=bot+applications.commands&permissions=8"
,
c
onfig
.
Client
ID
))
c
.
Redirect
(
http
.
StatusTemporaryRedirect
,
fmt
.
Sprintf
(
"https://discord.com/oauth2/authorize?client_id=%s&scope=bot+applications.commands&permissions=8"
,
c
li
.
ID
))
})
})
server
.
GET
(
"/support"
,
func
(
c
*
gin
.
Context
)
{
server
.
GET
(
"/support"
,
func
(
c
*
gin
.
Context
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment