Giter VIP home page Giter VIP logo

beatbattlebot's Introduction



Hi, I'm Jake! ๐Ÿ‘‹

I'm an experienced software engineer with a B.S. in Computer Science and some handy devops and leadership skills. I've enjoyed writing and teaching software since 2014, and I focus on communication, teamwork, and pragmatism. I heard once that "you should write code like the next maintainer knows where you live", and that one just really stuck with me.

If you're here for the Discord Battlebot, you've come to the right place!


Expert with:

  • Writing maintainable/testable code
  • Quickly learning new languages and systems
  • Java | Maven | JavaScript | NPM
  • Debian Linux | Bash | VIM (Custom)
  • Github | Jenkins | Bamboo | CI/CD
  • Devops and workflow optimization
  • Leadership skills and inclusion
  • Mentoring and teaching others
  • Giving constructive feedback
  • Receiving criticism optimistically
  • Collaboration and problem solving
  • Handling vague requirements
  • Applying new knowledge quickly
  • Staying cool under pressure

Experienced with:

  • Docker | Kubernetes | AWS EC2
  • Node.js | HTML5 | CSS3 | PHP
  • C | Golang | Python 3 | Android
  • MySQL | PostgreSQL | MongoDB
  • Apache | Nginx | Networking
  • Project Design | Architecture
  • OOD and Database Design
  • UI/UX Design and Graphics

Additional highlights:

  • Strong remote work skills
  • Excited to learn new technology
  • Can connect well with any team
  • A/V production and editing
  • Capable with music production, mixing, and a six-string

beatbattlebot's People

Contributors

jakethedev avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

cutofffrequency

beatbattlebot's Issues

Data Restructure: Battles and votes

Battle data should be renamed to "battlecachedao" and structured as follows:

{
    $battlename: {
        entries: { 
            $userid: { timestamp, link, displayname }, 
            $userid2: ....
       }, 
       votes: {
           $userid1: [ int... ],
           $userid2: [ int... ]
       },
       subdeadline: timestamp,
       votedeadline: timestamp
    },
    voteregistry: {
        $userid1: battlename,
        $userid2: anotherbattlename
    }
}

Note the voteregistry: this is how we handle vote processing, we find the user here, grab the battlename, and use that as the key to know where to save their vote. Saving the user with the vote allows revoting if something goes wrong, and allows us to count whats there with minimal issues

Also note this is one json: see #21 for a case to upgrade this to an actual data storage mechanism

!newbattle

Feature Request

  • !newbattle should be restricted to an array of roles, and should copy the current file cache to a .bak file, create a new empty json cache, and load the new one as a "reset" for a new battle session

Fix crash on !deadlines when no battle exists

Simple one, lets keep the bot alive shall we?

TODO

  • Audit uses of raw battle data
  • Ensure those uses have some safety for nullness
  • Ensure new battles are made with right data struct

Pull all business logic out of battlecachedao

Up until now it's made sense to have some logic at this layer, but it's time to fix that before it gets out of hand.

  • Audit uses of dao operations
  • Note expectations of each operation
  • Pull non-DAO logic out to controller level as _functions
  • Result: user -> controller layer -> dao layer
  • Consider: user -> command layer -> controller layer -> dao layer

Move data to mongo on improved hardware that can support the bot and DB

Blocked by #103

Currently: data is loaded as json, saved as json.
Pros: all lag is on startup, easy to use
Cons: this might get out of control

Future: data should be loaded to json from sql, saved as sql, sqlite is a good stepping stone
Pros: moves logic to database oriented approach, faster and better for scale
Cons: ton of work

Mutual pros: easy to copy from server to local and back, easy to edit
mutual cons: single file datasource is generally not a best practice but works just fine really

Additionally: consider mongodb vs sqlite

!submit link

Feature Request

  • !submit [link] should save the username and link to a software cache and a file cache

!vote X [Y, Z]: allow a user to vote in a battle

Feature Request

  • !vote should print a rich text message with each entrant and a stock emoji, then auto-reply to the message with all of the same emoji for easy-peasy vote buttons

I dont think this needs to close a battle or any other fancy tricks, simply print it statically and that's plenty.

This command should be restricted to power users. See battlelib/battlecmds.js:_isPowerfulMember()

!submissions party - print submissions in a musicbot friendly way

Simple one, great QOL improvement - implementer should check the discord groovybot commands for -queue and -play, and see if we can print (paginated per !submissions) commands for playlisting links to make it easy to preview/play the entries in a discord voice channel

!battle: quick summary command

outputs something like
there's no active battle
or
this battle has X submissions! There are no deadlines | Submissions close in XdYhr | Voting closes in XdYh | This battle has concluded, stay tuned for the next battle

!newbattle "Title of the battle here"

Instead of 'letsgo' as the "i confirm this action as a mod" keyword, just replace the switch with taking the input, sanitizing it real quick, then storing it as the battle name.

Maybe keep letsgo or confirmed as a keyword?

Blocked by #25, co-priority with #26

!play #voice-channel-name

Feature Request

  • have the bot join the listed channel (if present) and enter a paused state for playing battles back.

This requires either fancy API stuff or actual file entries, both of which sound like a lot of work that's not as easy as someone just streaming the entries via twitch/discord. Just saving it as a thought

!roster

Feature Request

  • !roster should print the current list of names of battlers, but maybe not tag them, just for an easy way to be like "who submitted" without printing the whole list

handle "!(\s+)[a-z]+" messages with help

handle ! [a-z]+ messages with a helpful reminder of the correct term

ie user days ! submission {link}.
bot could reply did you call for me? if you want to submit, please use !submit with the link

Fix legacy role code

With a revamped discord api (since 2017 when i first set up role code in Tavernbot), things have changed, and there's a significant difference in how to interact with the roles of a server.

We need to fix the implementation so !giverole and !listroles (and !rolemembers) work in the new way instead of the old one

!deadlines: send user deadlines for the current battle

Example output:

  • Submissions end in 6 days 9 hours, voting ends in 13 days 9 hours
  • Submissions are CLOSED, voting ends in 3 hours 17 minutes
  • This battle is over!
  • No deadlines are set, check your local battle announcements channel or ask a mod to inform me

!submit @user https://link for post-deadline entries or odd one-offs

Seems like a pretty unlikely situation, but when called for, it would be really nice to have a superuser-only command for manually creating an entry for a battle. Not that this should happen, just that it's entirely up to mod discretion, and having entries from people outside discord might be tight, so being able to manually enter links would be sick

Idea:
!submit @username https://link - input.trim() should have 1 space in it, and if anything's wacky, stop and let user know what went wrong

Guide for Entrants

Write out a guide, probably as a blog. Outline...

!submissions: to see if there are entrants, or an active battle
!submit https://link comment here: explain how submit works, updating is instant
!getballot and !vote: how to use, expectations

!feedback: mention this, note it can be DMd to bot

!battlename "Name for the battle"

A mod should be able to set the name of the battle, this could be displayed in !submissions, !vote, !results, and other places for better clarity and an overall note of polish.

This is blocked by #25, related to #27

Ideas: Music lib commands

!transpose key integerSteps: need to move Am up 6? boom done. Print resulting key and chord list.
!transpose key desiredKey: Print the number of steps to enter in a daw (+ and -), then print before and after chord lists

For music games
!songidea: generate a bpm, key, and some sort of "starter" idea - maybe pick a random generative command from below

!playlistpitch: print a playlist intended as a target for a writing session
!genre: gimme a random genre
!mood: gimme a random mood
!writersblock: helpful advice?

Requires _randomKey() with weighted choices toward more playable keys
!melody: pick a random key and print a melody in [1, 2, 3, 4, 5, 6, 7] (plus sharps/flats) notation
!chords: random key, provide 2-6 chords in [I ii iii IV V vi vii* III IVb Vdim] notation

Server data cache

Server data is starting to matter. Set up a simple structure, maybe like

serverid:
  name: $name
  botmodroles: [id|name]
  channels:
    channelid:
      votemax: 3 || !votemax results
      rules: $rules
      winners: [ids]

WIP note: could this live in config.js? That feels like a good fit for the purpose, maybe

Required for #76 and #47

battlecache: store battles by discord channel id

This should be easy: instead of
{ "server name_channel name": { "entries": ... } }
as the battle keys, we should just use id like
{ "id": { "name": "channel name", "entries": ... }

This case blocks #26 (!battlename)

Date utilities

Gonna need this for deadline output and such - day.js looks great, throw it in ~/util/datefmt.js and call it good?

!botmod add|remove for easier delegation

Blocked by #46 - should be done the same time as #15

!botmod add roleid|rolename: Add a role to servers power user group
!botmod remove roleid|rolename: Unadd a role/no-op

Any invalid input situation should return a help message. i.e. a missing rolename, or no input past command word

_isPowerfulMember() should also check a per-server list of roles

Currently, battlelib/battlecmds:_isPowerful... only checks if the user has one of two admin permissions. This should also check if their role set contains any of a list of roles provided to the bot at startup. (This location may change, check #14 before starting work here)

Note: Don't yak shave, startup set of roles is a great place to start here. Moving on to dynamic roles (roles set by an admin WITHIN a server) is a shift from stateless+defaults to stateful+defaults, and I don't like the idea of PRs making that shift at this time.

Command Update: !submissions dm

Feature Request

  • "!submissions dm" should DM the channel's submissions to the requestor. This is not a request for this command to work OVER dms, as battles are keyed to a channel name, but having a dm-reply option for this could make output a lot more manageable
  • Alternately: have !submissions reply by dm by default, and "!submissions here" could print in the channel

Add number of submissions to !submissions output

Probably just in the header text, the "here is the list" message could be "check out all X submissions" with an easter egg for single-submission lists like "check it out, this person brought the fire first!"

!sumbissions

Iykyk
Should be the same as submissions but reacts with ๐Ÿ˜‚ instead of a check mark

!unsubmit for easy withdrawal

A couple discord members suggested an unsub command. !submit https://anewlink was sufficient in those use cases, but being able to self-yeet from a battle should be supported (thanks thirdbeat!)

Expectation: remove a user and their link, or let them know they weren't in the battle. I expect unsubmit to work at any time including voting

!unsubmit @user would take a different code path, check for mod status, then unsubmit the @user's entry - captured in #87

Related to #67

!getballot: channel command for entering a vote session

When voting is active (sub deadline has passed and voting deadline is NULL or passed), running this in a channel should send the asker a list of submissions numbered by time of entry. This will place the user in a map located somewhere like "votesession[battlename]", so that when they call !vote (see #5) the bot knows where that vote should go.

!results [X=10]: mod only command for podium view of a beat battle

Blocked by #5 (!vote)

!results to DM top entries by votes to mod. X is an optional param for number of entries to show (e.g. !results 3),, defaults to 10. Parameter is ignored if asking for more than the maximum reasonable number of entries, which i'll set to "half of the entries list length"

!fb Feedback command suite, new command structure approach

Data organization thoughts

$serverid {
  feedback_$channelid {
    queue { id: { nick, link, notes } },
    cooldown: { id: datetime },
    cooldowndays: int
  },
  feedback_$channel2 { ... }
}

Command thoughts

!fb open // open a channel for feedback
!fb close // open a channel for feedback
!fb https:// optional notes here // submit a link, notes at the end. checks cooldown list
!fb notes required notes here // set notes, should be safe without a link so order doesnt matter, checks cooldown list
!fb cooldown INT // set channel cooldown to INT days
!fb cooldown reset // clean up cooldown list
!fb start // get a random feedback track, put submitter id in a data "hot seat"
!fb given // place "hot seat" in cooldown list
!fb reset // wipe entries and cooldowns, requires letsgo confirmation
all other subcommand input returns usage

New command: !submissions

Feature Request

  • !submissions should send the current battle's submissions to the channel of the battle

!setdeadline [interval]

A mod-only way to stop submissions. !stopsubs on its own would set the deadline to the time that command was entered, ending a battle, but 1stopsubs 2d5h would set the submission deadline to 2 days and 5 hours from the command time (rounded forward to the next half hour)

!begonebot

mod-only command that stops the bot from listening to this channel, probably using logic in util/discord?

can be implemented like any normal mod-only command

Blocks #73

!votingends [interval]

A mod-only way to stop voting. !stopvotes on its own would set the voting deadline to the time that command was entered, but 1stopvotes 1d7h would set the voting deadline to 1 day and 7 hours from the command time (rounded forward to the half hour).

!heylisten command to invite bot to a channel

mod-only command to add the channel where this was run to the bots watchlist. gotta have the zelda reference

for O(1) lookup and storage, data should be structured:
SERVERID: {
CHANNELID: true
}

note: this directly impacts message handling in bot.js,

Blocks #73

move battlelib/battlecmds:_isPowerfulMember to more global location

Just for easier importing across all commands. Be thoughtful about this location, i'd personally prefer a root level discordsupport.js file with

exports.isPowerfulMember = function(Discord.js:Member) {
...code
}
...
to be easiest to work with across the bot's codebase

Guide for Mods and Users

Write out a guide as a gist. Outline...

Current commands

!newbattle / letsgo: explain how to start a battle
!setdeadline and !votingends: usage and how they work
!deadlines: see results of above
!submit https://link comment here: explain how submit works, updating is instant
!stopsubs and !stopvotes and !stopbattle: shortcut for setting deadlines to now
!submissions: explain this output

!feedback: mention this, note it can be DMd to bot

Future commands, can go in guide when complete

!vote
!getballot and !vote: from a mod perspective
!results: mod-only ranked list

Coffee and tea commands

!coffee should be a refreshing hot beverage, !tea should be a more calming version of this

Techdebt: msg.reply is great but not a good default

Copied from tavernbot - i think having metadata on each command for "reply" that defaults to False would be useful, it could be loaded up in bot.js where it does the gnarly JS-style dynamic function wrangling (perhaps line 18, where the command meta is generated)

Note this only has impact in the global bot.js:client.on('message') callback, twice in the .then(), once in the .catch()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.