This is a Python bot that allows users to register a TrinityCore account by direct messaging a bot with specific commands. Users' Discord identifiers are tied to the game account and both the Discord identifier and the TrinityCore username are checked for duplicates.
- Python3
- Pip Packages:
mysql.connector
,discord
viapip install
- Easy Linux Command that installs the packages for you:
pip install mysql.connector && pip install discord
- Pip Packages:
- Access Discord's Developer Portal and create a
New Application
. - Navigate to the
Bot
section of your application settings and clickAdd Bot
.- Set the username and profile icon of the bot.
- Reset and save your bots
Token
. - No permissions are required, as the bot interacts via direct messages with users.
- Navigate to
OAuth2
->URL Generator
.- In the
Scopes
section:-
bot
-
- Copy the
Generated URL
and paste it into your browser to invite it to your server.
- In the
- The bot should now be visible (though offline) in the server you invited it to.
- Edit the bot config file, registration.cfg.
- The
[mysql]
settings should match the database settings of the TrinityCore MySQL server.- There are potential issues with setting
host = localhost
. Use127.0.0.1
instead. - A blank password will connect via the unix socket.
- There are potential issues with setting
- The
[discord]
settings should match the following:apiKey
is the botToken
generated above.targetServer
is the ID of a Discord server the bot is in.logsChannel
is the ID of a Discord channel in the server the bot is in.staff
is the ID of a Discord role required for "givemepowers"
- The
[soap]
settings should match the following:host
is the SOAP.IP in worldserver.confuser
is a user capable of using account create, and set password commands in-game.pass
is the password for that user.port
is SOAP.Port in worldserver.confsoapRBAC
is the RBAC role provided when "givemepowers" is called.
- The
[core]
settings have the following:brand
is the abbreviated brand of your core. Currently AC and TC are known and supported.
- The
- Edit the worldserver config file, worldserver.conf
-
- Set SOAP.Enabled = 1
-
- Run the bot.
- Ensure Requirements are met.
- Run
discord_bot.py
- Direct message the bot using the following syntax:
register <username> <password>
- If any errors occur during registration, the bot will let the user know.
- Direct message the bot using the following syntax:
account set password <newpassword> <newpassword>
- If any errors occur, the bot will inform the user.
- Direct message the bot using the following syntax:
givemepowers
- If any errors occur, the bot will inform the user.
- Give a command to authorize GM accounts under the right circumstances
- Add OS specific instructions
- Provide better instructions to maintain safe user permissions and practices
Anyone who uses this on their server is capable of logging passwords. Encourage your users to provide throwaway passwords or unique passwords. This is a potential way to steal credentials, so it's ethical that all users should be aware and instructed to create unique passwords for your server.
This bot uses the SOAP API to register accounts. So long as your core can handle the above commands and can support SOAP, this bot will work with it.
If you'd like to contribute, please fork and create a pull request. Your code will be reviewed and then merged with the main branch.