Irene Bot for Discord in Python

MujyKun, updated 🕥 2023-03-20 05:17:12

IreneBot v2.0 - A Complete Rewrite




V2.0 Release [REWRITE] 2023-03-19 22:38:03

V2.0 Release. A complete rewrite of the bot.

What's Changed

  • V2.0 - A complete rewrite. by @MujyKun in

Full Changelog:

V1.04.2 Release 2021-08-19 01:40:54

V1.04.2 Patch Notes

New Commands/Features:

Photos for: TRI.BE (1149) | HOPPIPOLLA (2339) | The Boyz Sangyeon (206) | N.flying (2425) | P1harmony (1973) | Ariaz (1153) | Lightsum (1803) | Kingdom (696) | ONEWE (7510) | Cross Gene (714) | Wanna One (4634) | ab6ix (18257)

Added Twitter Subscription commands: %twitter code/group/idol/list/reset
- Limit of 2 accounts for non patrons.
- Patrons get 5 times more account subscriptions than non patrons.

Added VLIVE Subscription commands: %vlive code/group/idol/list

Removed the concept of unregistered Idols/Groups and introduced the DataMod Role
- %addidol and %addgroup are now exclusive to data moderators.
- %edit idol/group command was added to edit any idol/group.
- All changes/additions to an idol/group are logged in a text channel.

DataMods, Translators, and Proofreaders are considered patrons and are synced for real-time changes.

The bot now has several languages included in the bot that can be set using %setlanguage (thanks to the translators).

Youtube, Archive, and Weverse modules have been removed from Irene.

Added several reload commands for quick and easy Bot Owner changes. - A module's loops are restarted when reloading.
- Also added cache commands.

Added spotify search to music.
- Waiting for library owners to fix bug regarding youtube links not working.
- Music may generally be broken as I have not updated some dependencies.
- Music was actually recoded twice during this update. The first time included full youtube functionalities, while the second one broke that adding Spotify.

%botinfo now displays number of BlackJack games.

Added UCubeBot for updates on

The Bias Game list will now show all of the idols that have won.

Added more shard details to the bot. - Added command %shard with alias shardinfo to give information about the shard the current server is using.

Bug/Issue/Backend Fixes/Changes:

GG will no longer wait 2 seconds if uploading from host.

Editing a banner/avatar will auto migrate to the host.

Edit command can not modify a date.

addidoltogroup & removeidolfromgroup now update the idol attributes as well.

BlackJack was fixed and is now playable. There was an issue with the second player of the game being compared when searching for a game.

%setlanguage no longer gives a KeyError if the language was not found.

Added stats for VLIVE and Twitter.

Requirements are now entirely reliant on IreneUtility.

Fixed Idol photos displaying a photo when a user limit was reached.

Fixed DM message in GG.

Added better logging in BJ.

Fixed Music not displaying commands.

Fixed spam messages when using the help command from local cog checks.

Status messages will now change every 1 minute instead of 30 seconds (was too soon).

Fixed group photos not being called correctly.

Fixed Twitch not notifying when an account goes live.

Added hot-reloading. Irene can now reload all packages/libs as well as the cogs that are already in the Bot.
- This actually was a lot harder to do than expected since IreneBot is dependent on IreneUtility.

Added auto daily backups instead of weekly manual backups. - Daily is kind of a stretch with how big the database is, but it'll be fine for now.

%approve command was removed.

Unscramble game now gives answer when skipping.

Unscramble game will no longer cause an infinite loop.

Removed unnecessary bolded unique inputs such as server link.

Removed nword and nwordleaderboard - No need for them anymore.

commands.json was created to have accurate information on every single command. - In the case the site is finished, this will allow for very accurate syncing between the commands of the bot and the sites without much manual change.
- Usually this info would be stored in the DB, but for a manageable state without altering from code, we will have it stored on a file that is shared across dev/prod.
- The help command is now based off this file.

%listbg has been embedded to prevent mentions.

Weverse (Includes the wrapper and the bot)

  • Added login and hook capabilities.
  • Fixed permission issues.
  • Added ability to load media.
  • Will no longer create old posts/media unless specified.
  • Added to
  • Can now post announcements.
  • Added ^list on the bot to see which communities are following the current channel.
  • Fixed account language issues by also including Korean trigger phrases.
  • Will auto publish in announcement channels.
  • Weverse Wrapper can now get information on videos.
  • WeverseBot can now post videos.
  • WeverseBot will use an image host link if the image is greater than 8 mb, otherwise it'll upload to discord directly.

UCubeBot (Includes the wrapper and the bot)

  • Created the bot off Weverse template.
  • Fixed invite link.
  • Added to
  • Added ^list on the bot to see which communities are following the current channel.
  • Will auto publish in announcement channels.

V1.04.1 Release 2021-06-29 01:02:58

V1.04.1 Patch Notes

New Commands/Features:

We now have a group guessing game!
-> Created command %groupguessinggame (Aliases: %ggg, %groupgg) to guess the names of groups instead of idol names.

Added %commands as an alias for %help.

Created a command %sendidol [idol id] [#text channel] to automatically post a photo of an
idol after every 12 hours in a channel.
-> Patrons get 3x more idols in a text channel than non-patrons do.
-> not specifying an idol id will remove all idols in the channel.
-> To remove an idol, you may repeat the command you used to add them.

Added skip to unscramble game

Added amount of unscramble games to botinfo

Photos have been added for:
First Batch: -> Chungha,HyunA,Sunmi,Lee Hi,Yerin Baek,Ailee,BoA,Heize,Rothy
After School (All Members),DIA (All Members),Kara (All Members),PurpleBeck (All Members),
4Minute (All Members),Cravity (All Members)

Second Batch: -> ONEUS (22583), ONF (6295), Victon (10758), CIIPHER (688), WEi (1495), ELRIS (11436), lunarsolar (1102), Ghost9 (97), Super Junior (9316), BTOB (12882), NU'EST (11567)

Automatic Twitter Updates were added. (They have been temporarily disabled)

The facial recognition for all of Irene's photos are now done! This means data is more accurate for the guessing games!

Weverse has been disabled. We are now reliant on discord announcement channels in the support server!

Added letteamor, everglow, ftisland, woo!ah!, ikon, blackpink, and just b to Weverse.

Although currently unusable by regular users, Weverse media now has a toggle (%disablemedia (community_name))

Bug/Issue/Backend Fixes/Changes:

Added Active Unscramble games as a metric.

Recoded process for receiving an idol photo. It was way too complex.

Metrics Added:
-> # of Unscramble Games
-> # of Text Channels with automatic idol photos
-> # of idol photos sent every 12 hours

Server Prefixes and Bot ID are no longer bolded from language packs.

It is now possible for Irene to upload straight from host
(it will upload images from host when the image is < 8 mb, otherwise
it will use the image host url). The reason for this is to ensure discord
actually loads the photo from Irene's image host (it's rare but sometimes it does not).

GuessingGame answer is now properly displayed on console and logs for debugging.

When the bot boots up, it is now automatically in maintenance mode.

All pending asyncio tasks are now closed safely on bot exit.

Irene's logging system are now VERY specific with tracebacks displaying the method and class name of the occurrence.
-> Now using Aiofiles

Added a blocking manager to Irene to detect cases where Irene is stalling.

Fixed profile level resetting. -> This issue was caused by messages being sent when cache was not fully loaded.

Fixed BlackJack game not announcing proper winner.

Fixed BiasGame repeating end message twice.

Params for API:
-> Added Min and Max face count for an image
-> Added ability to filter if you want videos
-> Removed group photos param
-> Now accept form data sent in as params
-> Redirect param remains as is

Added dev mode to Irene. This way we can run a production version of the bot without messing up important data.

Weverse no longers loads all past cache and loads in < 10 seconds instead of 10 minutes now.

V1.04.0 Release 2021-06-01 20:30:24

V1.04.0 Patch Notes

New Commands/Features:

Added ability to toggle games using %togglegames.

Added Unscramble Game! %help UnScramble (unscramble, usleaderboard, stopus) Unscramble difficulties are portrayed as below:
-> Easy - Only Stage Names (from easy idols).
-> Medium - Stage/Full/Group Names (from medium idols).
-> Hard - Former Full/Stage Names + Aliases + All capitalized letters are now lowercase (from hard idols).

3YE, P.O.P, Maka Maka, Ikon, Winner, Brave Girls, KARD, Ladies Code

Added np as an alias for %recent

Added default roles when a user joins a server using %welcomerole.

Group names are now an allowed input for %ggfilter but are not as accurate as group ids.

Former full name and former stage name are now correct answers for a guessing game.

Irene now uses its own translation system if Weverse does not have a translation.

Guessing Game can now report images using dead or report instead of skip.
-> The reason for this is due to constantly waiting for a dead link reaction, whereas dead or report
will ask for a double confirmation.
-> Skip will now be used as an actual skip/pass without the option to report.

%endgame was renamed to %stopbj.

New command %stopgames (Aliases: %endgames/%stopgame/%endgame) was added to stop ALL games in the current text channel
or that the user is a host of.

Bug/Issue/Backend Fixes/Changes:

Fixed Session ID not appearing on %botinfo.

Fixed Twitch Notifications

Fixed NWL dictionary changed size during iteration (created a copy).

Made NWL faster to work with millions of users a lot quicker.

%choose was embedded to avoid unnecessary/accidental mentions.

%botinfo now works as expected.

Fixed patron status disappearing after 12 hours.

Created Official Documentation for Weverse and adjusted IreneBot to any code changes.

Created a new image host server, this way discord will be able to download images from months ago in history if
they do not exist without making a direct API call.
-> Will make a call to api if image does not exist.
-> Limits 25k photos existing at once
-> Deletes random file if there are more than 25k photos.

ALL WJSN photos were deleted and replaced.

Added requirement for more specific youtube urls.

Added Metrics For:
-> Amount of Text channels with games disabled.
-> Amount of dead images.
-> Amount of User Objects.
-> Amount of welcome roles.
-> Amount of playing cards.
-> Amount of members in support server.
-> Amount of users with gg filter enabled.

Bias game should no longer say it was force-closed when it ended normally.

Added more appropriate error message for %addidol and %addgroup since users found it confusing.

V1.03.9 Release 2021-05-12 22:57:22

V1.03.9 Patch Notes

New Commands/Features:

API has public random photo endpoint.

Wolfram requests are now paginated if it is long.

MIRAE & Cherry Bullet were added to Weverse.

Added a group filter for guessing games (ggfilter). These scores do not count towards the leaderboard.

Added Language Packs (setlanguage) -> Currently only english available.

Currency and BlackJack have been entirely recoded and have been re-enabled.
-> Player VS Bot has been removed.
-> Currency rates have been lowered. Once finalized, all currency from users will be wiped to zero to reduce the crazy inflation.
-> BlackJack has been recoded to allow for custom cards with idols. (Instantly generated from Idol Avatars)

Added API endpoint for guessing game (for other developers, not currently used on IreneBot.)

Added API endpoint for members with photos (for other developers)

Cleared Bias Game Photos so new avatars were properly regenerated.

Created a new cog/module ONLY for a bot owner and moved all bot owner commands there to stop confusion of what a user can use in a module.

A new check has been added for facial detection before going to the production db.

Photos for BIBI, Lucy, DreamNote, Dal Shabet, Honey Popcorn, Bestie, Bonusbaby, Golden Child, Weki Meki, Loona, Verivery, SHINee, SF9, AKMU, STAYC, and SISTAR were added this update.

%resetcache was added to manually reset cache instead of having to wait 12 hours.

Users must now be in the support server to play Guessing/Bias Game. This is important for accurate user feedback.

Weverse messages no longer have a 5 second delay per channel.
-> This is a test in production to see how affected the bot will be.

Bug/Issue/Backend Fixes/Changes:

IreneBot now requests from localhost instead of direct domain.

Weverse account token was regenerated to load newer posts.

Filtered Guessing Game list is no longer paginated if it is one page.

Fixed Weverse Comments not posting ( had changed their format
-> still needs to be looked into more).

Fixed guessing game end messsage being posted twice.

Guessing and Bias Games are now properly removed from cache after any errors.

Created more efficient language pack design by having a list of keyword and inputs to iterate over to not have several replace statements in a single command just to get all input set up properly. We can now also directly change input from the Utility get_msg method itself.

GG, BG, and BJ are now all concrete subclasses of an abstract Utility Game model and have been moved to the Utility models folder.

Utility was made portable.
-> Any instances created in the properties of Utility would be set in the client
-> Any utils accessing a client module were moved.

N-Word is no longer hard-coded and is a list in an environment variable.

card, remindme, and ggfilter have been either embedded, or removed user input on message in order to remove unintentional mentions.

Fixed weverse messages coming back blank and not sending a lot of posts.

A note is now left on guessing game on how to disable the ggfilter if there are no results.

If an idol and group have the same name, all of the idols are put into a list and chosen randomly.
-> ex: Weki Meki Lucy & the group Lucy.
-> The issue was occurring so that only the idol would be posted and not the group.

Fixed DEV branch to not be so unstable for production.

Patreon Cache now loads during reset cache. This fixes the issue with patrons not being recognized.

Patrons now have priority check when posting an idol photo.

When the Bot restarts, Live Twitch channels are not sent to a channel again and it keeps track in the DB.

Added a bare yield to majority for loops.

countmember and countgroup were fixed.

SQL is now in a separate part in the Utility. This means it will be much easier to switch libraries if ever needed be, and it is just cleaner code in general.

IreneAPI is now on its own repository.

IreneUtility is now on its own repository BUT THE VERSION NUMBERS MATCH TO EACH OTHER

A logging function has been created for skipped errors.
-> Try Except Passes are now rendered into a third file as unimportant errors.

Majority methods in Utility and across IreneBot are now documented better than they were before.

Fixed issue where members that are in support server are not able to use gg or bg.
-> Fixed by making our own member support server cache.

IreneBot and IreneUtility have been redesigned in a way that will support type-casing a lot more.

Moved Keys to a separate object in Utility for proper type-casing support.

Fixed commands not being responsive.
-> Issue was two clients being created.

Fixed broken help command.
-> Utility object that temporarily created was pointing to the wrong check method.

Removed possible negative numbers on currency by defaulting all balance amounts to 0 if less than 0.

Guilds Table is now accurately updated when guilds join/leave and is reset completely everytime discord cache reloads.

Fixed guessing game idol difficulties not containing the right idols.

Added safety check for guessing game not ending.

Users in a currency game can no longer use certain currency commands.

V1.03.8 Release 2021-03-13 10:03:12

V1.03.8 Patch Notes

New Commands/Features:

Full/Stage Name and the Idol Id now appears when calling an idol photo.

Channels with Verse and Self Assignable Roles have been added as datadog metrics.

If %time (user) is used and the input is not a user, it will check for the time in a timezone.

Server-Sided NWord LB has been added.

Vote Requirement increased from 12 hours to 24 hours.

Added Twitch Notifications (%addtwitch %listtwitch %removetwitch, %settwitchchannel, %settwitchrole)

Added pagination to %listroles

Added link to commands in %help

Added Scientific Notation to currency leaderboard if the amount is above the known value places.

15 results now show on bias game leaderboards instead of 10.

Bug/Issue/Backend Fixes:

Fixed memory leak issues with biasgame.

Fixed Majority API issues.

Fixed guessing game not properly loading.

The entirety of the API was recoded in Python.

Unsupported locale on host is accounted for in regards to user timezones.

Single pages on music are not longer paginated.

Trash emoji on dead images now works.

Kill command now properly terminates background processes

%nwl now displays 10 results instead of 11.

Fixed the inaccurate amount of text channels subbed metrics that are being sent.

Fixed Guessing Game randomly crashing from names that start with the prefix.

Fixed normal patrons not being considered a patron once discord cache loaded.

Fixed duplicate stream notifications. Check time was increased from 30 seconds to 1 minute.


Senior @ IUPUI '23

GitHub Repository Homepage

kpop irene bot discord music dcapp dreamcatcher korean python postgres weverse patron idols moderator