Compare commits
11
Commits
v0.0.1-dev
...
v0.0.6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d876f4ced9 | ||
|
|
fb4d7977aa | ||
|
|
68a02e2f24 | ||
|
|
30394b35e5 | ||
|
|
87961c5081 | ||
|
|
562ec6acaf | ||
|
|
3169953f3f | ||
|
|
d119425236 | ||
|
|
ce1bbbc445 | ||
|
|
35882993c2 | ||
|
|
85bcb31d56 |
@@ -4,16 +4,12 @@ name: CI
|
|||||||
# with a tag like v1.0.0 or v1.0.0-dev
|
# with a tag like v1.0.0 or v1.0.0-dev
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
- development
|
|
||||||
tags:
|
tags:
|
||||||
- v[0-9]+.[0-9]+.[0-9]+
|
- v[0-9]+.[0-9]+.[0-9]+
|
||||||
- v[0-9]+.[0-9]+.[0-9]+-[a-zA-Z]+
|
- v[0-9]+.[0-9]+.[0-9]+-[a-zA-Z]+
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
if: github.event.base_ref == 'refs/heads/master' || github.event.base_ref == 'refs/heads/development'
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||||
@@ -31,8 +27,6 @@ jobs:
|
|||||||
- name: Login to Amazon ECR
|
- name: Login to Amazon ECR
|
||||||
id: login-ecr
|
id: login-ecr
|
||||||
uses: aws-actions/amazon-ecr-login@v1
|
uses: aws-actions/amazon-ecr-login@v1
|
||||||
with:
|
|
||||||
repositories: goff
|
|
||||||
|
|
||||||
- name: Get Version
|
- name: Get Version
|
||||||
id: get_version
|
id: get_version
|
||||||
@@ -46,3 +40,5 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
|
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
|
||||||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
|
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
|
||||||
|
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:latest
|
||||||
|
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
|
||||||
|
|||||||
+4
-19
@@ -8,31 +8,17 @@ import (
|
|||||||
|
|
||||||
"github.com/dustinpianalto/disgoman"
|
"github.com/dustinpianalto/disgoman"
|
||||||
"github.com/dustinpianalto/goff/utils"
|
"github.com/dustinpianalto/goff/utils"
|
||||||
"github.com/kballard/go-shellquote"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func addTagCommand(ctx disgoman.Context, input []string) {
|
func addTagCommand(ctx disgoman.Context, input []string) {
|
||||||
if len(input) >= 1 {
|
if len(input) >= 1 {
|
||||||
args, err := shellquote.Split(strings.Join(input, " "))
|
|
||||||
if err != nil {
|
|
||||||
if strings.Contains(err.Error(), "Unterminated") {
|
|
||||||
args = strings.SplitN(strings.Join(args, " "), " ", 2)
|
|
||||||
} else {
|
|
||||||
ctx.ErrorChannel <- disgoman.CommandError{
|
|
||||||
Context: ctx,
|
|
||||||
Message: "",
|
|
||||||
Error: err,
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
queryString := `SELECT tags.id, tags.tag, tags.content from tags
|
queryString := `SELECT tags.id, tags.tag, tags.content from tags
|
||||||
WHERE tags.guild_id = $1
|
WHERE tags.guild_id = $1
|
||||||
AND tags.tag = $2;`
|
AND tags.tag = $2;`
|
||||||
row := utils.Database.QueryRow(queryString, ctx.Guild.ID, args[0])
|
row := utils.Database.QueryRow(queryString, ctx.Guild.ID, input[0])
|
||||||
var dest string
|
var dest string
|
||||||
if err := row.Scan(&dest); err != nil {
|
if err := row.Scan(&dest); err != nil {
|
||||||
tag := args[0]
|
tag := input[0]
|
||||||
if tag == "" {
|
if tag == "" {
|
||||||
ctx.ErrorChannel <- disgoman.CommandError{
|
ctx.ErrorChannel <- disgoman.CommandError{
|
||||||
Context: ctx,
|
Context: ctx,
|
||||||
@@ -41,7 +27,7 @@ func addTagCommand(ctx disgoman.Context, input []string) {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if len(args) <= 1 {
|
if len(input) <= 1 {
|
||||||
ctx.ErrorChannel <- disgoman.CommandError{
|
ctx.ErrorChannel <- disgoman.CommandError{
|
||||||
Context: ctx,
|
Context: ctx,
|
||||||
Message: "I got a name but no value",
|
Message: "I got a name but no value",
|
||||||
@@ -49,7 +35,7 @@ func addTagCommand(ctx disgoman.Context, input []string) {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
value := args[1]
|
value := strings.Join(input[1:], " ")
|
||||||
if value == "" {
|
if value == "" {
|
||||||
ctx.ErrorChannel <- disgoman.CommandError{
|
ctx.ErrorChannel <- disgoman.CommandError{
|
||||||
Context: ctx,
|
Context: ctx,
|
||||||
@@ -61,7 +47,6 @@ func addTagCommand(ctx disgoman.Context, input []string) {
|
|||||||
queryString = `INSERT INTO tags (tag, content, creator, guild_id) VALUES ($1, $2, $3, $4);`
|
queryString = `INSERT INTO tags (tag, content, creator, guild_id) VALUES ($1, $2, $3, $4);`
|
||||||
_, err := utils.Database.Exec(queryString, tag, value, ctx.Message.Author.ID, ctx.Guild.ID)
|
_, err := utils.Database.Exec(queryString, tag, value, ctx.Message.Author.ID, ctx.Guild.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Send(err.Error())
|
|
||||||
ctx.ErrorChannel <- disgoman.CommandError{
|
ctx.ErrorChannel <- disgoman.CommandError{
|
||||||
Context: ctx,
|
Context: ctx,
|
||||||
Message: "",
|
Message: "",
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ go 1.14
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/bwmarrin/discordgo v0.20.3-0.20200525154655-ca64123b05de
|
github.com/bwmarrin/discordgo v0.20.3-0.20200525154655-ca64123b05de
|
||||||
github.com/dustinpianalto/disgoman v0.0.10
|
github.com/dustinpianalto/disgoman v0.0.12
|
||||||
github.com/dustinpianalto/rpnparse v1.0.1
|
github.com/dustinpianalto/rpnparse v1.0.1
|
||||||
github.com/emersion/go-imap v1.0.5
|
github.com/emersion/go-imap v1.0.5
|
||||||
github.com/emersion/go-message v0.12.0
|
github.com/emersion/go-message v0.12.0
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ var postfixes = []postfix{
|
|||||||
Name: "1_Update_X_Guild_Prefixes_to_add_ID",
|
Name: "1_Update_X_Guild_Prefixes_to_add_ID",
|
||||||
Invoke: updateXGuildPrefixesToAddID,
|
Invoke: updateXGuildPrefixesToAddID,
|
||||||
},
|
},
|
||||||
|
postfix{
|
||||||
|
Name: "1_Update_Tags_Content_Length",
|
||||||
|
Invoke: updateTagsContentLength,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func RunPostfixes() {
|
func RunPostfixes() {
|
||||||
@@ -75,3 +79,20 @@ func updateXGuildPrefixesToAddID(revert bool) error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func updateTagsContentLength(revert bool) error {
|
||||||
|
var queryString string
|
||||||
|
if !revert {
|
||||||
|
queryString = `ALTER TABLE tags
|
||||||
|
ALTER COLUMN content TYPE varchar(2000)`
|
||||||
|
} else {
|
||||||
|
queryString = `ALTER TABLE tags
|
||||||
|
ALTER COLUMN content TYPE varchar(1000)`
|
||||||
|
}
|
||||||
|
_, err := Database.Exec(queryString)
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user