-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New/Better Slash Commands #162
Open
kylepokorski
wants to merge
22
commits into
Nv7-GitHub:main
Choose a base branch
from
kylepokorski:betterslashcommands
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
74724bf
Adding some new slash commands
kylepokorski 09d2ab3
Hintid and info elementid
kylepokorski 839535f
Adding Rejection DM
kylepokorski 753cd17
Adding distinct to idea and creating /random_combination
kylepokorski e8354fc
Update main.go
kylepokorski 84470cf
Update main.go
kylepokorski a6ac8c0
Merge branch 'main' into betterslashcommands
kylepokorski 0628566
Merge pull request #4 from kylepokorski/main
kylepokorski fad66e7
Adding page option
kylepokorski ac43784
Merge branch 'main' of https://github.com/kylepokorski/Nv7Haven
kylepokorski a443e96
change command text
kylepokorski 96e7b3d
Change "change" to "edit"
kylepokorski f9a109e
Merge branch 'betterslashcommands' of https://github.com/kylepokorski…
kylepokorski ed4ddc9
More changes per Nv7
kylepokorski ec0531e
ping aliases
kylepokorski fafbbe1
Minor improvements
kylepokorski 0eb226f
Adding emoji to category and query info
kylepokorski 868866f
Merge branch 'Nv7-GitHub:main' into betterslashcommands
kylepokorski 24f67b5
Merge pull request #5 from kylepokorski/main
kylepokorski b2fee7f
Comparison createdon query
kylepokorski 43fe723
/search and randomcombo update
kylepokorski 00e0ca9
Search now separate commands
kylepokorski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package base | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/Nv7-Github/sevcord/v2" | ||
"github.com/bwmarrin/discordgo" | ||
"github.com/lib/pq" | ||
) | ||
|
||
func (b *Base) Take(c sevcord.Ctx, opts []any) { | ||
c.Acknowledge() | ||
|
||
user := opts[0].(*discordgo.User).ID | ||
q, ok := b.CalcQuery(c, opts[1].(string)) | ||
if !ok { | ||
return | ||
} | ||
|
||
// remove from inv | ||
_, err := b.db.Exec(`UPDATE inventories SET inv=inv-$1 WHERE guild=$2 AND "user"=$3`, pq.Array(q.Elements), c.Guild(), user) | ||
if err != nil { | ||
b.Error(c, err) | ||
return | ||
} | ||
|
||
// Respond | ||
c.Respond(sevcord.NewMessage(fmt.Sprintf("Succesfully removed elements from <@%s>!", user))) | ||
} | ||
func (b *Base) Set(c sevcord.Ctx, opts []any) { | ||
c.Acknowledge() | ||
|
||
user := opts[0].(*discordgo.User).ID | ||
q, ok := b.CalcQuery(c, opts[1].(string)) | ||
if !ok { | ||
return | ||
} | ||
|
||
// set to inv | ||
_, err := b.db.Exec(`UPDATE inventories SET inv=$1 WHERE guild=$2 AND "user"=$3`, pq.Array(q.Elements), c.Guild(), user) | ||
if err != nil { | ||
b.Error(c, err) | ||
return | ||
} | ||
|
||
// Respond | ||
c.Respond(sevcord.NewMessage(fmt.Sprintf("Succesfully set elements to <@%s>!", user))) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I implemented this before and people made categories with every element, which takes like hundreds of megabytes of space in the DB, which is why I deleted it. Encourage people to use queries instead of adding stuff from queries to categories
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wondering how big even is the DB anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about if it was a mod only thing or had some sort of limits?