Open grizzlywhiskey opened 10 months ago
def _init_channels(bot: Bot): """Initialize Channels via ID lookup (alpha-order please)."""
bot.almanac_channel = bot.guild.get_channel(int(os.environ['ALMANAC_CHANNEL']))
_log_named(bot.almanac_channel, 'Barovian Almanac channel')
bot.skirmish_board_channel = bot.guild.get_channel(int(os.environ['SKIRMISH_BOARD_CHANNEL']))
_log_named(bot.skirmish_board_channel, 'Skirmish Board channel')
bot.tattoo_inventory_channel = bot.guild.get_channel(int(os.environ['TATTOO_INVENTORY_CHANNEL']))
_log_named(bot.tattoo_inventory_channel, 'Tattoo Parlor inventory channel')
bot.vistani_inventory_channel = bot.guild.get_channel(int(os.environ['VISTANI_INVENTORY_CHANNEL']))
_log_named(bot.vistani_inventory_channel, 'Vistani Market inventory channel')
bot.xpholder_backup_reminder_channel = bot.guild.get_channel(int(os.environ['XPHOLDER_BACKUP_REMINDER_CHANNEL']))
_log_named(bot.xpholder_backup_reminder_channel, 'XPHolder backup reminder channel')
bot.cakeday_announcement_channel = bot.guild.get_channel(int(os.environ['CAKEDAY_ANNOUNCEMENT_CHANNEL'])) _log_named(bot.cakeday_announcement_channel, 'cakeday announcement channel')
941847567724056596
bot.bot_development_channel = bot.guild.get_channel(int(os.environ['BOT_DEVELOPMENT_CHANNEL']))
_log_named(bot.bot_development_channel, 'bot development channel')
1196535506209619988
bot.bot_notification_channel = bot.guild.get_channel(int(os.environ['BOT_NOTIFICATION_CHANNEL']))
_log_named(bot.bot_notification_channel, 'bot notification channel')
1196534995364348004
bot.dungeon_masters_channel = bot.guild.get_channel(int(os.environ['DUNGEON_MASTERS_CHANNEL']))
_log_named(bot.dungeon_masters_channel, 'dungeon masters channel')
942384310047100928
bot.fishing_channel = bot.guild.get_channel(int(os.environ['WILDS_BOTSPAM_CHANNEL']))
_log_named(bot.fishing_channel, 'fishing channel')
988258501824512020
bot.past_adventures_channel = bot.guild.get_channel(int(os.environ['PAST_ADVENTURES_CHANNEL']))
_log_named(bot.past_adventures_channel, 'Past Adventures channel')
1196538043880968232
bot.past_adventures_backup_channel = bot.guild.get_channel(int(os.environ['PAST_ADVENTURES_BACKUP_CHANNEL']))
_log_named(bot.past_adventures_backup_channel, 'Past Adventures backup channel')
1196538163913560084
bot.player_roles_channel = bot.guild.get_channel(int(os.environ['PLAYER_ROLES_CHANNEL']))
_log_named(bot.player_roles_channel, 'player roles channel')
941848739000238131
bot.queue_channel = bot.guild.get_channel(int(os.environ['QUEUE_CHANNEL']))
_log_named(bot.queue_channel, 'queue channel')
1042429910817452103
bot.staffxp_reminder_channel = bot.guild.get_channel(int(os.environ['STAFFXP_REMINDER_CHANNEL']))
_log_named(bot.staffxp_reminder_channel, 'Staff XP reminder channel')
988265298987720764
bot.starboard_channel = bot.guild.get_channel(int(os.environ['STARBOARD_CHANNEL']))
_log_named(bot.starboard_channel, 'Starboard channel')
1054555211781394492
bot.tupper_logging_channel = bot.guild.get_channel(int(os.environ['TUPPER_LOGGING_CHANNEL']))
_log_named(bot.tupper_logging_channel, 'Tupper logging channel')
1196538575693549669
def _init_threads(bot: Bot): """Initialize Threads via ID lookup (alpha-order please).""" bot.fishing_rewards_thread = bot.guild.get_thread(int(os.environ['FISHING_REWARDS_THREAD'])) _log_named(bot.fishing_rewards_thread, 'fishing rewards thread')
1194823573622235167
bot.queue_snapshots_thread = bot.guild.get_thread(int(os.environ['QUEUE_SNAPSHOTS_THREAD']))
_log_named(bot.queue_snapshots_thread, 'queue snapshots thread')
1196540843704713237
def _init_roles(bot: Bot): """Initialize Roles via ID lookup (alpha-order please).""" bot.dungeon_master_role = bot.guild.get_role(int(os.environ['DUNGEON_MASTER_ROLE'])) _log_named(bot.dungeon_master_role, 'Dungeon Master role')
941844448390807582
bot.fish_master_role = bot.guild.get_role(int(os.environ['FISH_MASTER_ROLE']))
_log_named(bot.fish_master_role, 'Fish Master role')
988276178068594738
bot.fisher_role = bot.guild.get_role(int(os.environ['FISHER_ROLE']))
_log_named(bot.fisher_role, 'Fisher role')
1195618047784923157
bot.helper_role = bot.guild.get_role(int(os.environ['HELPER_ROLE']))
_log_named(bot.helper_role, 'Helper role')
941847096212992022
bot.mods_role = bot.guild.get_role(int(os.environ['MODS_ROLE']))
_log_named(bot.mods_role, 'Mods role')
1195617032830472212
bot.players_role = bot.guild.get_role(int(os.environ['PLAYERS_ROLE']))
_log_named(bot.players_role, 'Players role')
941844883440820315
bot.skirmisher_role = bot.guild.get_role(int(os.environ['SKIRMISHER_ROLE']))
_log_named(bot.skirmisher_role, 'Skirmisher role')
987554415902867477
bot.staff_role = bot.guild.get_role(int(os.environ['STAFF_ROLE']))
_log_named(bot.staff_role, 'Staff role')
1196541674998992958
bot.training_dm_role = bot.guild.get_role(int(os.environ['TRAINING_DM_ROLE']))
_log_named(bot.training_dm_role, 'Training DM role')
941846963840770098
bot.year_one_player_role = bot.guild.get_role(int(os.environ['YEAR_ONE_PLAYER_ROLE']))
_log_named(bot.year_one_player_role, 'Year 1 Player role')
1196541900304437268
def _init_message_ids(bot: Bot): """Initialize well-known message IDs.""" bot.class_roles_message_id = int(os.environ['CLASS_ROLES_MESSAGE_ID']) _log_nameless(bot.class_roles_message_id, 'class roles message ID')
def _init_google_sheets(bot: Bot): """Initialize references to Google Spreadsheets.""" bot.almanac_gsheet_id = os.environ['ALMANAC_GSHEET_ID'] _log_nameless(bot.almanac_gsheet_id, 'Almanac Google Sheet ID')
def _init_github(bot: Bot):
"""
Initialize GitHub repo names and access tokens.
NOTE: use _log_secret()
to avoid logging tokens in plaintext.
"""
bot.archive_access_token = os.environ['GITHUB_ADVENTURE_ARCHIVES_ACCESS_TOKEN']
_log_secret(bot.archive_access_token, 'Github adventure archives access token')
Unsure what this is?
bot.archive_repo = os.environ['ADVENTURE_ARCHIVES_REPO']
_log_nameless(bot.archive_repo, 'Adventure Archives repo name')
"Sobros-Adventure-Tome" https://github.com/Sun-of-Sobros/Sobros-Adventure-Tome
def _log_conditionally(x: T, subject: str, fn: Callable[[T], str]): """Log presence or absence of an entity X (used for verifying correct config).""" log.info(f'Found {subject} = {fn(x)}') if x else log.error(f'Unable to find {subject}')
def _log_named(x1: Any, subject: str): """Log presence or absence of an entity with a 'name' attribute.""" _log_conditionally(x1, subject, lambda x2: x2.name)
def _log_nameless(x1: Any, subject: str): """Log presence or absence of an entity WITHOUT a 'name' attribute.""" _log_conditionally(x1, subject, lambda x2: str(x2))
def _log_secret(x1: Any, subject: str):
"""Log presence or absence of an entity whose value must remain secret."""
_logconditionally(x1, subject, lambda : '
@gayanku I've done some legwork above for the ID's for each Bot pull - the ones that are going offline have been skipped, but the rest of the roles/channel/thread links are provded.
Anything like this I can be helping with to reduce workload for you just let me know
Features
This attempts to be an up-to-date list of the functionality the bot provides.
Bot Commands The bot recognizes messages having a certain prefix as special commands - see player_commands.py and staff_commands.py. Execution of these commands is restricted by member Role.
RECONNECT AND ACTIVATE:
Cakeday Announcements The bot does a daily check for users having their cakeday (a.k.a. server join anniversary) today. If found it sends a congratulatory message to those players and gives them a special role to highlight their achievement - see cakeday.py.
Staff XP Reminder The bot posts a weekly reminder for helpers to claim their bonus Staff XP - see staffxp_reminder.py.
Adventure Archiving The bot has a utility to export a range of messages as HTML (using the chat-exporter lib) and then upload them to a Github Pages repo, thereby "archiving" the adventure - see archive.py.
Queue Snapshots The bot takes periodic snapshots of the player queue for Skirmishes, Missions, and Adventures and writes them to an admin thread - see queue_snapshots.py.
Event Signup Ordering The bot can rank players signing up for an event by their position in the queue - see signups.py.
Fish Bounty Rewards The bot detects when a player catches a fish (using !fish) that earns a reward - see fishing.py.
Starboard Reports The bot analyzes #starboard messages since the last Player of the Week announcement and prints statistics - see starboard.py. It also posts a weekly reminder to make the announcement.
Copying Messages The bot can copy a range of messages from a source channel to a destination channel - see copy_messages.py.
DEACTIVATE:
Refresh Vistani Market Inventory The Vistani Market inventory is randomly regenerated on a regular schedule - see vistani_market.py.
Refresh Tattoo Parlor Inventory The Tattoo Parlor inventory is randomly regenerated on a regular schedule - see tattoo_parlor.py.
Barovian Almanac The bot posts a daily "almanac entry" consisting of fictious information for weather, calendar, moon phase, etc. The data is drawn from an external Google Spreadsheet inspired by a post in r/CurseOfStrahd - see almanac.py.
Story Token Reminder The bot posts a monthly reminder for DMs to claim their Story Token - see story_token_reminder.py.
XPHolder Backup Reminder The bot posts a weekly reminder for mods to backup character data from the XPHolder bot - see xpholder_backup_reminder.py.
Skirmish Reset Announcements The bot makes a weekly announcement that the diminishing rewards for skirmishes have been reset - see skirmish_reset.py.
Prune Nonmember Reactions The bot can remove message reactions that were added by users who are no longer members - see prune_reactions.py.