Git Product home page Git Product logo

pad-cogs's Introduction

pad-cogs

Important: You must use Python 3.8 for the setup!! If you use an earlier or later version, things WILL break. It's not just convenient to be on the same version as us, it's mandatory.

Setting up your own Tsubaki instance

Prerequisites / Tools

  • Install Git
  • Install Python 3.8
  • Familiarize yourself with how to use a command prompt and Git Bash (if you can't do this you will have a bad time)

Red's Installation Guide is a useful resource if you're a first timer.

I suggest using PyCharm Community for development. Change into the PycharmProjects directory and clone your fork of the repo:

Check out the repo

Fork this repo (you are probably already on the page, but if not go here).

Note: If you are developing a cog that is in the misc-cogs repo, you may need to complete some steps for both pad-cogs AND misc-cogs.

You will need a GitHub account to do this. Click the button that says "Fork" in the upper-right-hand corner of the page.

Git clone your forked repository.

Create a Discord Bot

If you don't have one already, follow the instructions to create a bot in Red's official documentation:

Creating a bot account

Keep the bot token that you get from Discord at the end of the instructions handy - you will need it to set up the bot later.

Installation

  1. Clone this repo (fork if you're contributing)
  2. Create a python 3 venv. virtualenv -p python3 <envname>
  3. Activate the venv.
  4. pip install -r requirements.txt

The above steps install Red automatically. You can now follow the Red instructions to startup the bot:

Setting Up and Running Red (macOS)

In command line:

  • redbot-setup
  • redbot <bot_name>

Configure Your Bot

The rest of the guide takes place from inside Discord. Replace ^ with your prefix to talk to your bot.

Tell your bot where to find the code

Once the bot is launched, set it to use your repo directory as a cog path. Type this in Discord where the bot is:

^addpath path/to/repo/root

e.g

^addpath /Users/Tsubaki/src/pad-cogs

Note: you may have to do this for pad-cogs, core-cogs, and misc-cogs. If you have forked and cloned core & misc cogs, this process is the same! However, if you are only developing in pad-cogs, and installing core-cogs & misc-cogs from remote repos then:

  1. ^load downloader (this cog is always installed by default)
  2. ^repo install misc https://github.com/TsubakiBotPad/misc-cogs
  3. ^repo install core https://github.com/TsubakiBotPad/core-cogs
  4. Now you can install, for example, the menulistener cog with ^repo install core menulistener. The menulistener cog is what makes the ^id menus interactive instead of single-panel static screens with unusable emoji below them.

Load cogs

Load relevant cogs (whichever cogs you are developing, dbcog, and padinfo) using the ^load command.

Note: We suggest you load dbcog and padinfo so that you will have something to test that your bot installation correctly installed; however, if your development does not involve dbcog as a dependency, you may want to keep it unloaded (^unload dbcog, get it back with ^load dbcog at any time), simply because it is very slow for the bot to initialize dbcog on startup, and you might be restarting your bot a lot during development, e.g. if you ever need to edit or update a library.

Syntax: ^load <cog 1> ... <cog n>

e.g
^load dbcog padinfo

You can see which cogs you have loaded using the ^cogs command.

Test a simple command

You should now be able to run basic commands like ^id

^id tsubaki

Should return something like:

image

Happy developing!

Appendix

Debugging

  • Use ^traceback 1 if you encounter any errors to display them in discord.

Emoji

You may have noticed that emojis are replaced with placeholders in some commands. This is because the bot does not have access to the specific emojis.

  • If you are doing in-depth development of the ^id command, your bot will need to be invited to the emoji servers. Talk to River to get access to these servers.

  • Once you and your bot have joined the servers, use ^padinfo emojiserver add <server_id_1> ... <server_id_n> with the IDs she gives you.

Cog list

Most cogs here relate to the mobile game 'Puzzle & Dragons'.

Cog Purpose
azurlane Azur Lane card lookup
crowddata Crowdsourced data collection
crud Database editor. Not useful for bots other than prod Tsubaki
dbcog Central cog to host all PAD data
dungeoncog A cog to search and get info for dungeons
damagecalc Simple attack damage calculator
feedback A specialized feedback cog for Tsubaki specifically
monidlistener A listener to give info for monster ids
padboard Converts board images to dawnglare board/solved board links
padbuildimg Creates images of PAD teams via a special query language
padbuilds See user-made builds for dungeons i think??? (nobody uses this)
padevents A scheduler cog to help players see upcoming daily GH dungeons.
padglobal Global PAD info commands
padle A wordle-inspired monster guessing game
padinfo Monster lookup and info display
padmonitor Keeps an eye out for PAD updates
pipelineui Interface for running the pipeline (Tsubaki-only)
pricecheck Lumon's thing. Something about stamina trade equivalence
profile Global user PAD profile storage and lookup

pad-cogs's People

Contributors

alianin avatar aliceyzhou avatar blastose avatar chasehult avatar dchang0413 avatar droonkid avatar ethanngoh avatar ethannp avatar kary5678 avatar loopdeer avatar muffin-rice avatar rheingoldriver avatar tactical-retreat avatar tejstead avatar tsubakibotpad avatar turtleworks avatar viciousslayer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

ssac kenkenyeung

pad-cogs's Issues

new cog: pricecheck

this is like a clone of which and should be editable by padglobal admins but don't make it part of padglobal, make a new cog, we need to split up padglobal into multiple cogs as-is

note that only lumon will be editing this but I don't think theres a need to add yet another set of admin permissions, we trust padglobal admins

commands available to padglobal admins:

  • pcadmin add - adds a stamina cost
  • pcadmin edit - edits a stamina cost
  • pcadmin remove - removes a stamina cost
  • pcadmin setratio - sets the ratio of plus point to stamina cost

commands available to anyone:

pricecheck <lookup term>

  • case > 99 mp: This card is not tradeable!
  • case not in database: This card is tradeable, but there is no information in the database for it

Default case, where there is information about the card, here is lumon's mockup:
image

It should also have a disclaimer saying this is not endorsed by the Tsubaki owners or server admins or whatever and is just lumon's project or whatever but we can figure that out

Important tech:

  • Clone of which
  • Showing all the material for stuff
  • Setting the stamina ratio
  • Not actually part of padglobal because this cog has SO MUCH and we need to split it up omg

[padinfo] ^leaderskill should have additional separators

Add ,, ., and / as separators for the ^ls command instead of only allowing " to separate multi-word lookups

Example: ^ls base v / yugi or ls base v, yugi or ls base v . yugi should resolve.

The reason for the . as a separator is to support people on mobile having a very easy lookup.

Make sure this patch doesn't break current functionality; ls "base v" yugi should still resolve.

This issue has been claimed by Lunatic.

[padinfo] ^id3 disambig screen

  • overview tab has a list of the cards (up to 10 best matches)
  • reactions are home screen plus 0-(up to 9)
  • home screen goes back to home
  • 0 - 9 goes to each of the monsters
  • when you click on a monster, it adds 👀 and see #175

^numberscroll

So this is like collabscroll but for numbers

So we have -1K, -100, -10, -1, +1, +10, +100, +1K emojis, and then it goes up more if a monster doesn't exist. there's no extra tabs, just the overview

yay this sounds so fun and cool

Rewrite scheduler

^scheduler new <name> <message>
^scheduler delete <name>
^scheduler edit <name> <message>
^schedulerset begin <name> <time>
^schedulerset end <name> <time>
^schedulerset interval <name> <interval>
^schedulerset channels <name> <list, of, channels>
^schedulerset enable <name>
^schedulerset disable <name>

padevents pings rewrite

TLDR add a config object, also move it out of the padevents command group

^autoeventping add <key>
^autoeventping show <key> - print all the config for a particular aep
^autoeventping remove <key>
^autoeventping list
^autoeventping setlogchannel <channel> - this is for the logging of summary queries that max wants

  • Channel - ^autoeventping set channel <key> <channel> - where it prints everything to
  • or optionally - ^autoeventping set redchannel <key> <channel> - etc for each color
  • Searchstring - ^autoeventping set event <key> <searchstring> - the string to be in the dungeon name
  • Searchmode - ^autoeventping set searchmode <key> <mode> - either regex or plain, default should be plain
  • Set three different roles - ^autoeventping set roles <key> <red> <blue> <green>
  • Set one role - ^autoeventping set redrole <key> <red>, etc
  • Set server (PAD server) - ^autoeventping set server <key> <na/jp/kr>
  • Enable - ^autoeventrping set enabled <key>
  • Disable - ^autoeventrping set disable <key>
  • Offset - ^autoeventrping set offset <key> <minutes> - this is the number of minutes before the dungeon starts that the ping should happen. The format of the message should now say, will start in {} minutes!

Survey tree

Did we get it right? (and tell people about ^idmode survey)
Immediately -> Log that menu showed up
Immediately -> Show yes/no /go away buttons

Yes click -> log it
No click -> log it, edit message to show google form link
Go away click -> edit message to say, "are you sure you want us to go away?" + remove go away click + add "only sometimes" button
Second go away click -> log user preference to never get menu ever again, edit message to say "okay we won't show this again"
Only sometimes click -> log user preference to only sometimes get menu, edit message to say "okay we'll show this only sometimes"


Also add ^idmode survey always, ^idmode survey sometimes, and ^idmode survey never

And owner-only, ^idmode survey setsometimes <number> to set the percentage of sometimes

[padevents] strip " and ' from search strings in autoeventping and autoeventdm

In ^autoeventping set searchstr, the characters " and ' should be stripped from input along with whitespace before the input is saved (currently only whitespace is stripped)

Works: ^autoeventping set searchstr Extreme KMD
Does not work but should: ^autoeventping set searchstr "Extreme KMD"

Similarly in ^autoeventdm edit searchstr make the same change.

These are the only two commands that need the change.

[padinfo] add number of latent slots

display should be:

Available Killers: [8 slots] Devil Healer Machine

Aradia needs to do this since it's using new data from the pipeline for the first time

Changing miru nicknames sheet into a cog requirements

I'm calling the base command crud for now because I'm not sure a better name for it but it can be called something else.

We will have to keep track of what has been manually edited, not just insert the new values into the db and be done with it.

Basenames

Here, it will look up an id and do the modification to the card's tree
^crud basename add<id> <string> <?comment>
^crud basename show <id> - this will return a numbered list so that we can remove by number or string. Also display the comments in the show reports.
^crud basename del <id> <number or string>
^crud basename search <string> - return all cards that with string appearing in their modified value

Nicknames

Here, it will do the modification to the card itself
^crud nickname add <id> <string> <?comment>
^crud nickname show <id>
^crud nickname del <id> <number or string>
^crud nickname search <string>

Pantheons

Actually I'm not sure if this tab is used?? Is this done through the actual crud? But I guess either way we need it
^crud pantheon add <id> <string> <?comment>
^crud pantheon show <id> <string>
^crud pantheon del <id> <number or string>
^crud pantheon search <string>

Pantheon nicknames

This is used in id2 and we are definitely absolutely keeping this functionality id2 b sam3
^crud pantheonnick add <string pantheon> <string nickname> <?comment>
^crud pantheonnick show <pantheon>
^crud pantheonnick del <int or string>
^crud pantheonnick search <string>

Base commands

^crud search <string> - return all matches of string in anything modified
^crud help - return a link to the wiki page explaining how everything works (at least it explains nickname vs basename)

autoeventdm outline

  • ^aed add na "search term" group offset - offset is donor-only due to load concerns. If a non-donor provides an offset say, "offset is donor-only. Create anyway? You can become a donor here at any time and the offset will start applying: "

  • ^aed list - provides a (numbered) list of all currently-running aeds

  • ^aed delete <int> - deletes that entry (prompt for confirmation)

  • ^aed purge - deletes all (prompt for confirmation)

  • ^aed edit offset <int> <int> edits the offset of entry firstint to secondint minutes

  • ^aed edit ......etc for all the ones from aep that make sense here

ALSO

^aedh edit offset @username int int - these are gated to bot owner only (or even better, managed via gadmin so that we can delegate additional aed helpers) and let us set something for a user when they come to us for help, it's the same as the above just injects a username at the start of the command so we don't have to make them type it themselves

aedh stands for autoeventdmhelp

[padinfo] per-server setting to disable tabs in ^id command

Add a per-server setting to disable some tabs in ^id command

Motivation: The list of tabs populates kinda slow.

Implementation details:

  • This would require human-readable names for the tabs, and should not be done based on number, in case tabs are added or removed. human-readable names should probably just be the same as the commands to focus them individually, so like otherinfo, pic, mats, etc
  • A nonexistent tab name in the ignorelist should fail silently not crash
  • Bringing up that tab specifically should override it being in the ignorelist but otherwise respect ignorelist, e.g. if pic and otherinfo are in the ignorelist but you do ^pic tsubaki, you would get pic but not otherinfo for this one command
  • Collabscroll should respect the same ignorelist (for now at least)
  • Command available to modrole

Should probably discuss whether this is actually worth implementing & whether there's other complications prior to spending time on this

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.