Compare commits

..
5 Commits
Author SHA1 Message Date
Dustin Pianalto d345044b3a Add milliseconds to timestamp
CI / build (push) Has been cancelled
2021-07-23 12:39:35 -08:00
Dustin Pianalto b3aff0828c Add snowflake command
CI / build (push) Has been cancelled
2021-07-23 12:34:09 -08:00
Dustin Pianalto 3d4518f961 Don't log message edits if the After is blank (problem with message embeds)
CI / build (push) Has been cancelled
2021-07-01 19:54:12 -08:00
Dustin Pianalto 37e8fa52af Fix bug in getting tasks
CI / build (push) Has been cancelled
2021-06-22 12:58:42 -08:00
Dustin Pianalto a370c76ba4 Add Auto Role Feature
CI / build (push) Has been cancelled
2021-06-22 02:20:08 -08:00
6 changed files with 37 additions and 3 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ func ParseDateString(inTime time.Time) string {
} else {
dateString = "Now"
}
stamp := inTime.Format("2006-01-02 15:04:05")
stamp := inTime.Format("2006-01-02 15:04:05.000")
return fmt.Sprintf("%v\n%v", dateString, stamp)
}
@@ -29,6 +29,9 @@ func OnMessageUpdate(session *discordgo.Session, m *discordgo.MessageUpdate) {
log.Println(err)
return
}
if m.Content == "" {
return
}
embed := &discordgo.MessageEmbed{
Title: fmt.Sprintf("Message Edited: %v", msg.ID),
Description: fmt.Sprintf("**Before:** %v\n**After:** %v\nIn Channel: %v", msg.Content, m.Content, channel.Mention()),
+1
View File
@@ -27,6 +27,7 @@ func AddCommandHandlers(h *disgoman.CommandManager) {
_ = h.AddCommand(utils.GitCommand)
_ = h.AddCommand(utils.InviteCommand)
_ = h.AddCommand(utils.PingCommand)
_ = h.AddCommand(utils.SnowflakeCommand)
_ = h.AddCommand(tasks.AddReminderCommand)
_ = h.AddCommand(tags.AddTagCommand)
_ = h.AddCommand(tags.TagCommand)
+2 -2
View File
@@ -325,7 +325,7 @@ func makeAutoRoleCommandFunc(ctx disgoman.Context, args []string) {
return
}
}
_, _ = ctx.Send(fmt.Sprintf("%s will be added to all new memebers.", r.Name))
}
var RemoveAutoRoleCommand = &disgoman.Command{
@@ -385,5 +385,5 @@ func removeAutoRoleCommandFunc(ctx disgoman.Context, args []string) {
return
}
}
_, _ = ctx.Send(fmt.Sprintf("%s will no longer be added to all new memebers.", r.Name))
}
+1
View File
@@ -100,6 +100,7 @@ func getTasksToRun() []Task {
res, err := postgres.DB.Query(query, time.Now())
if err != nil {
log.Println(err)
return nil
}
var tasks []Task
for res.Next() {
+29
View File
@@ -218,3 +218,32 @@ func userCommandFunc(ctx disgoman.Context, args []string) {
}
}
}
var SnowflakeCommand = &disgoman.Command{
Name: "s",
Aliases: nil,
Description: "Return the parts of a snowflake",
OwnerOnly: false,
Hidden: false,
RequiredPermissions: 0,
SanitizeEveryone: true,
Invoke: snowflakeCommandFunc,
}
func snowflakeCommandFunc(ctx disgoman.Context, args []string) {
int64ID, err := strconv.ParseInt(args[0], 10, 64)
if err != nil {
ctx.CommandManager.ErrorChannel <- disgoman.CommandError{
Context: ctx,
Message: "Not a valid ID",
Error: err,
}
return
}
s := discord_utils.ParseSnowflake(int64ID)
embed := &discordgo.MessageEmbed{
Title: args[0],
Description: fmt.Sprintf("Created: %s\nWorker: %d\nProcess: %d\nCounter: %d", discord_utils.ParseDateString(s.CreationTime), s.WorkerID, s.ProcessID, s.Increment),
}
_, _ = ctx.Session.ChannelMessageSendEmbed(ctx.Channel.ID, embed)
}