Giter Club home page Giter Club logo

tyrbot's Introduction

Tyrbot

Tyrbot is an in-game chatbot for the MMORPG Anarchy Online released by Funcom in 2001.

This is a rewrite of Budabot in Python 3.

Quickstart

  1. Download the bot: https://github.com/Budabot/Tyrbot/archive/master.zip
  2. Unzip the bot to a location on your computer
  3. Run start.bat
  4. The first time you run the bot it will ask some questions. You will need four pieces of information: username, password, character name, and superadmin. For any other question you can simply press <Enter> to use the default value.

Requirements

Tyrbot has been tested on Python 3.9 and 3.11. You may run into issues with other versions of Python.

Installation

Tyrbot is now ready for general use and is recommended over Budabot or any other bot for all new installations.

Currently there are no releases for Tyrbot but you can download the bot from here which will always have the very latest changes: https://github.com/Budabot/Tyrbot/archive/master.zip

Then simply unzip the bot somewhere before starting it.

Upgrade

If you are already running Tyrbot and simply want to upgrade to the latest version, follow these steps:

  1. Download the latest version from here: https://github.com/Budabot/Tyrbot/archive/master.zip
  2. Unzip the bot to a new location (do not just unzip it over the top of the old installation)
  3. From the old installation, copy the ./conf, ./data, and optionally, the ./logs directories to the new installation
  4. If you have any custom modules, copy the ./modules/custom/ directory over as well
  5. Start the bot and verify everything works and that all of your data has carried over
  6. In a few rare cases, the bot may not start because the config file format changed between versions and you may need to compare your config.hjson to the template version and make changes accordingly
  7. You can now delete the old installation

Note: If you are upgrading from Tyrbot 0.5 or earlier, the config file format has changed. The config.hjson file has been replaced by config.py and you will have to go through the setup wizard again to configure the new config file.

If you want to upgrade from Budabot, follow the instructions here: https://github.com/Budabot/Tyrbot/wiki/Migrating-From-Budabot

Starting Tyrbot

To start the bot, run either start.bat or start.sh.

If it is your first time running the bot, or if the config.py file does not exist, it will take you through the configuration wizard to configure the bot. You will need to have a character name that you you want to run the bot as along with the username and password for the account that has that character. If you want to run this bot as an org bot, the character that the bot runs as will need to already be a member of that org.

Support

If you need help or support with Tyrbot, join our discord channel: https://discord.gg/2x9WesJ

Discord Module Setup

If you would like to connect your bot to your Discord server, follow this guide: https://github.com/Budabot/Tyrbot/wiki/Discord-Setup

Writing Custom Modules

See the Wiki page: https://github.com/Budabot/Tyrbot/wiki/Writing-Custom-Modules

Running in Docker

See the Wiki page: https://github.com/Budabot/Tyrbot/wiki/Docker

tyrbot's People

Contributors

bigwheels16 avatar cap5lut avatar deathlef avatar dependabot[bot] avatar dustify avatar einarf avatar equinitry avatar fatpower avatar hughp135 avatar jroovers avatar kristinhansen avatar minidodo1 avatar nepherius avatar teeko7 avatar trellixvulnteam avatar twamp22 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tyrbot's Issues

!items results could be more concise

When the !items lookup only has a few results, the results should be given in the channel the lookup was requested in(tells, org chat, private channel, etc). This is similar to how budabot handles item lookups.

Poll Module

The poll module should spam people that have not voted on currently running polls upon login. This would further differentiate it from the current /org vote feature.

Fresh python install gives me syntax error in file "/home/pi/Tyrbot/core/text.py", line 13

Traceback (most recent call last):
File "bootstrap.py", line 36, in
Registry.load_instances(paths)
File "/home/pi/Tyrbot/core/registry.py", line 84, in load_instances
cls.load_module(file)
File "/home/pi/Tyrbot/core/registry.py", line 90, in load_module
importlib.import_module(file.replace("\", ".").replace("/", "."))
File "/usr/lib/python3.5/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 986, in _gcd_import
File "", line 969, in _find_and_load
File "", line 958, in _find_and_load_unlocked
File "", line 673, in _load_unlocked
File "", line 669, in exec_module
File "", line 775, in get_code
File "", line 735, in source_to_code
File "", line 222, in _call_with_frames_removed
File "/home/pi/Tyrbot/core/text.py", line 13
self.setting_service: SettingService = registry.get_instance("setting_service")
^
SyntaxError: invalid syntax

self.setting_service: SettingService = registry.get_instance("setting_service")

on fresh python3 + pip install.
Am I missing a dependency? I have tried modifying
self.setting_service: SettingService = registry.get_instance("setting_service")
to
self.setting_service = registry.get_instance("setting_service")
which python accepts but these kind of assignments(I think?, I'm not familiar with python) are used on multiple locations in the code.

reduce docker image sizes

the docker images are quite, looking at 1.3-15-ga5c32468, its
linux/amd64 114.65 MB
linux/arm64 185.64 MB

the difference is because for arm64, gcc has to be pulled for some python modules, which is only used once,

this is one of the reasons why i would suggest a multi-staged docker build, one for building (which would pull in the gcc) and then an actual runtime build, similar to what dotnet's asp.net core is doing.

Topic

Topic does not spam to people upon login or joining the private channel, as it did in budabot. This is typically used as a message upon login that people do not need to click on, like they do news, and also(for raid bots) any information that should be communicated to users upon joining. Is this intended behavior or a bug? When should the topic be sent to users?

Update flag for startup scripts

Summary of discussion on discord

We should add an update flag to both startup.bat and startup.sh that will do a git pull when starting/restarting bot. Info about this should be in README.md possibly also linking to git download for windows users.

When not passing the flag to scripts the auto updating will not happen. This gives users more control. It's not uncommon for users to mess with files increasing the chance for merge conflicts during git pull.

See dev.sh for reference. Add flag check.

EDIT: This flag should probably be optional. If not present, no updating will happen. Users have to opt in by providing the flag.

type hints for service injection

having type hints for dependency injection like self.text: Text = registry.get_instance("text") can help alot to reduce the development time (especially for beginners), to dont having to guess where types are (due to naming conventions this is still pretty fast tho)
and to have better hints for auto completion when using the respective service.

it was mentioned that in earlier python versions type hints caused issues due to circular dependencies, so it might not be possible to hint this for every injected service, but for the core services the hints - if possible - should be added

add optional message to restart and shutdown

I'd like to have this because I often restart bot in live org for updates.

It would be nice if the bot could broadcast a reason to channels why it is being restarted or shutdown so people are not left without answers why it was done.

Raid Module

Currently, if you start a raid and set a min_level there is no way to override that for a character that recently(since the last update of the character info) met that requirement. There should be a !raid add charname command so a raider can be manually added.

Org Module issue

In the org module, there are two settings:
private_channel_joined - Notify when a character joins the private channel [Enabled] On Off
private_channel_left - Notify when a character leaves the private channel [Enabled] On Off

Each of these should be split to have separate settings per channel, so you can have the notification in the private channel and/or the notification in the org channel.

!boss/!bossloot issues

!boss and !bossloot does not handle bosses with the same name at multiple locations

e.g. use !bossloot gem of sand

Bossloot Search Results for 'gem of san' (1)

Lord of Sand
Location: None
Loot: Gem of the Sands

also when doing !boss lord of sand


Lord of Sand
Location: None
Loot: Gem of the Sands

but when doing !whereis lord of sand

Whereis 'lord of sand' (2)

Lord Of Sand
The Reck; Northern Eremite Statue waypoint: 2267x2902 RECK

Lord Of Sand
The Reck; Southern Eremite Statue waypoint: 1533x237 RECK

port !bank from budabot

port !bank, or have some equivalent feature, from budabot. Should be investigated to see if this is the best way to handle an "org bank".

ModuleNotFoundError: No module named 'pkg_resources'

I'm just relaying this from discord:

Quick question im trying to run tybot on a fresh install of ubuntu 24 server i have python3 and pip install sqlite3 etc but when i try to run the bot im getting this error:

ModuleNotFoundError: No module named 'pkg_resources'
Traceback (most recent call last):
    File "/home/dev/aobots/bootstrap.py", line 8, in <module>     from upgrade import run_upgrades
    File "/home/dev/aobots/upgrade.py", line 1, in <module>     from core.db import DB
    File "/home/dev/aobots/core/db.py", line 4, in <module>     from pkg_resources import parse_version

the user is not using docker.

pkg_resources comes from setuptools, which seems to be not installed by default there, so adding it to requirements.txt might fix this.

Gridnet Module Improvements

The Gridnet module should have a one command "off" switch. Also we should have separate settings for whether or not the bot spams to org chat and private channel.

Port !track from Budabot

Tracklist is useful for keeping track of important people outside the org without using your own friendslist. This feature is missing in Tyrbot.

Permissions with subcommand

Subcommands do not have specific permissions, which makes certain commands very unsafe. Including !loot, which is enabled for "all" by default, makes it so anyone can do !loot remitem, !loot clear, and !loot roll. This should be remedied by either changing these to other commands within a same "loot module" or "raid module". This could also be remedied by having permissions assigned to subcommands.

Gridnet automatically on

Currently, gridnet is automatically enabled despite RK5 bots having no use for it. This should be changed. Possible resolutions could be allowing the bot to check what dimension it is on and selecing the default based on the dimension, or forcing it off and allowing players to turn it on with a single command, see issue #42

!poll doesn't restrict voting within alts family

Players can vote on polls using more than one character, even when they are registered within the same main/alts family. This should be updated so that they can only vote once and the vote is attributed to their main.

Bot updater

  • Add some sort of !git update (or w\e) command, for updating the bot without direct manual interaction. (@see here)

This Issue is more of an "sidenote for me, if i get the time for it. If someone else is faster, create an PR! :)

Discord module disconnecting and not properly reconnecting

Occasionally, the discord module will error out with:
INFO - websockets.protocol - Failing the WebSocket connection: 1011
INFO - discord.gateway - Websocket closed with 1006 (), attempting a reconnect.
INFO - discord.client - Got ResumeWebSocket

The bot then doesn't automatically reconnect to discord, but the bot thinks it is connected. So the only way to then connect to discord properly is to restart the bot.

maintaining consistency in "loot" commands with budabot and users expectations

Currently the help for the loot command looks like this: Show the list of added items with suggestions in parenthesis
Show the list of added items:
!loot (should be !loot list for consistency)
Clear all loot:
!loot clear
Remove existing loot:
!loot remitem item_index
Add an item to loot list:
!loot additem item [item_count] (This should be !loot <item link/name> here and it should auto recognize item names like budabot did. Also, if the same item is added twice, it adds it in two seperate listings, instead of increasing the item count, as budabot did. The budabot behavior was more intuitive to users and is the understood behavior)
Increase item count:
!loot increase item_index
Decrease item count:
!loot decrease item_index
Add yourself to item:
!loot add item_index
Remove yourself from item:
!loot rem
Roll all loot:
!loot roll
Rebuild loot list:
!loot reroll
Used by the loot lists to add items to loot list:
!loot additem raid item_id item_count (this isn't very clear how this works even)
Add all loot from given raid:
!loot addraid raid category (also not sure how this even works, I'm assuming these two commands work in conjunction with the raid module?)

!raid addpts causes SQL error with MySQL/MariaDB

When trying to add points for raiders, eg !raid addpts tnh (the preset doesnt matter as long as it is a valid one) an exception was thrown.

this error only occurs when using MySQL or MariaDB, it does not occur for SQLite.

Reproduction steps:

  • use a bot that is configured for MySQL/MariaDB
  • !raid start test
  • !raid addpts tnh
testbot-mysql      | 2024-01-28 10:10:51,951 - INFO - core.tyrbot - (bot0) From Capmafroob: raid addpts tnh
testbot-mysql      | 2024-01-28 10:10:52,010 - ERROR - core.command_service - error processing command: raid addpts tnh
testbot-mysql      | Traceback (most recent call last):
testbot-mysql      |   File "/app/deps/mysql/connector/connection_cext.py", line 633, in cmd_query
testbot-mysql      |     self._cmysql.query(
testbot-mysql      | _mysql_connector.MySQLInterfaceError: Field 'log_id' doesn't have a default value
testbot-mysql      |
testbot-mysql      | The above exception was the direct cause of the following exception:
testbot-mysql      |
testbot-mysql      | Traceback (most recent call last):
testbot-mysql      |   File "/app/core/db.py", line 58, in _execute_wrapper
testbot-mysql      |     cur.execute(sql if self.type == self.SQLITE else sql.replace("?", "%s"), params)
testbot-mysql      |   File "/app/deps/mysql/connector/cursor_cext.py", line 330, in execute
testbot-mysql      |     result = self._cnx.cmd_query(
testbot-mysql      |              ^^^^^^^^^^^^^^^^^^^^
testbot-mysql      |   File "/app/deps/mysql/connector/opentelemetry/context_propagation.py", line 77, in wrapper
testbot-mysql      |     return method(cnx, *args, **kwargs)
testbot-mysql      |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
testbot-mysql      |   File "/app/deps/mysql/connector/connection_cext.py", line 641, in cmd_query
testbot-mysql      |     raise get_mysql_exception(
testbot-mysql      | mysql.connector.errors.DatabaseError: 1364 (HY000): Field 'log_id' doesn't have a default value
testbot-mysql      |
testbot-mysql      | The above exception was the direct cause of the following exception:
testbot-mysql      |
testbot-mysql      | Traceback (most recent call last):
testbot-mysql      |   File "/app/core/command_service.py", line 207, in process_command
testbot-mysql      |     response = handler["callback"](CommandRequest(conn, channel, sender, reply), *self.process_matches(matches, handler["params"]))
testbot-mysql      |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
testbot-mysql      |   File "/app/modules/standard/raid/raid_controller.py", line 236, in points_add_cmd
testbot-mysql      |     account = self.points_controller.get_account(raider.main_id, request.conn)
testbot-mysql      |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
testbot-mysql      |   File "/app/modules/standard/raid/points_controller.py", line 242, in get_account
testbot-mysql      |     self.create_account(main_id, SenderObj(conn.get_char_id(),
testbot-mysql      |   File "/app/modules/standard/raid/points_controller.py", line 253, in create_account
testbot-mysql      |     self.add_log_entry(main_id, sender.char_id, "Account opened by %s" % sender.name)
testbot-mysql      |   File "/app/modules/standard/raid/points_controller.py", line 230, in add_log_entry
testbot-mysql      |     return self.db.exec(sql, [char_id, amount, leader_id, reason, int(time.time())])
testbot-mysql      |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
testbot-mysql      |   File "/app/core/db.py", line 114, in exec
testbot-mysql      |     row_count, lastrowid = self._execute_wrapper(sql, params, map_result, log_query)
testbot-mysql      |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
testbot-mysql      |   File "/app/core/db.py", line 62, in _execute_wrapper
testbot-mysql      |     raise SqlException("SQL Error: '%s' for '%s' [%s]" % (str(e), sql, ", ".join(map(lambda x: str(x), params)))) from e
testbot-mysql      | core.db.SqlException: SQL Error: '1364 (HY000): Field 'log_id' doesn't have a default value' for 'INSERT INTO points_log (char_id, audit, leader_id, reason, created_at) VALUES (?,?,?,?,?)' [1673852042, 0, 1673852370, Account opened by Captestslav2, 1706436652]
testbot-mysql      | 2024-01-28 10:10:52,024 - INFO - core.tyrbot - (bot0) To Capmafroob: There was an error processing your request.

Items command has stopped working in Budabot

Just in the last few days our install of Budabot 3.5_GA has been unable to find the items database on Github and the "!Items" has stopped functioning. I am a Novice at chatbots, could anyone help with instructions how to fix this? Or is happening to others too?

Ginger201

Leaderecho

Leaderecho currently defaults to off and must be turned ON on a per raid basis. Budabot had this defaulted to ON and was turned OFF with a setting in the bot. How should this be handled?

  1. As-is, defaulted to off and only turned on for a single raid at a time
  2. Default to on and turned off for a single raid at a time
  3. have a setting in the bot that turns it on/off globally

Premade implant incorrect

This is the incorrect fixer head implant: Fixer Head Intelligence 1 Handed Edged Weapon, Nano Pool, Tutoring

This is the correct fixer head implat: Fixer Head Intelligence Psychic, Nano Pool, Tutoring

Pagination issue

When doing !nanolines 53 a second window is created, but it is empty.

Discord Module Relay Settings vs Events Inconsistency

When setting up the discord module, the setting "Global setting for relaying of Discord messages to the private channel" is a one way setting. It only disables the relaying of discord messages TO the private channel, To disable private channel messages being relayed to the discord, you have to disable the event "private_channel_message - Relay messages to Discord from private channel".

This issue applies to the org channel setting/event in the same window as well.

investigate auto invite behavior

Budabot behavior: !autoinvite on automatically grants someone the member access level and adds them to buddy list with auto invite on. Alts of member access level can use this to add their alts to the bot.

Tyrbot behavior: !autoinvite on only invites someone if they were already on the member list. Alts cannot use this to add themselves to the bot.

We need to decide how we want this command to work in the future.

Wont start on FreeBSD

I have downloaded and installed the application. I am getting the following error:

Traceback (most recent call last):
File "bootstrap.py", line 2, in
from core import config_creator
File "/home/user/Tyrbot-master/core/config_creator.py", line 3, in
import hjson
ModuleNotFoundError: No module named 'hjson'

It cycles until I end the task. I have hjson installed:

Name: hjson
Version: 3.0.1
Summary: Hjson, a user interface for JSON.
Home-page: http://github.com/hjson/hjson-py
Author: Christian Zangl
Author-email: [email protected]
License: MIT License
Location: /usr/local/lib/python3.6/site-packages
Requires:
Required-by:

And pip list shows:
hjson 3.0.1

I'm not sure what else to do here, please can you help?

Enviroment variables for account details

A suggestion:

When running Tyrbot in docker it's nice to save a compose setup and config in a git repository. Some are weary saving account details in git, so an improvement could be the following:

Support the following enviroment variables:

TYRBOT_USERNAME
TYRBOT_PASSWORD
TYRBOT_CHARACTER
TYRBOT_SUPERADMIN

This would replace the coresponding values in the config.hjson. This way the bot operators can keep and docker env file outside git.

account.env (not in version control)

TYRBOT_USERNAME=myaouser
TYRBOT_PASSWORD=aopassword
TYRBOT_CHARACTER=mrbot
TYRBOT_SUPERADMIN=theboss

docker-compose.yaml

bot:
    build: mybot
    env_file:
        - account.env

Discord Relay

Discord relay module borked, not connecting. I think since discord changed from .gg to .com

Online alignment discord

Output of !online in discord should have proper alignment with name/side/level/profession, etc.

Logon/Logoff

Logon/Logoff commands should have a "clear" subcommand, to clear your characters current logon/logoff message.

Cancel raffle not working

raffle_controller.py", line 38, in raffle_cancel_cmd self.job_scheduler.cancel_job(self.raffle.scheduled_job.id) AttributeError: 'int' object has no attribute 'id'

note: on rk2019 and sqlite db

move !bank to subcommand

!bank should be moved to be a subcommand. Potentially under !account. !addpts could possibly be moved here as well, further simplifying the raid module.

Temporary Guest Access Level

Create a Temporary Guest Access Level for when a character is invited to the private channel but not added as a permanent member. This would allow us to prevent the "all" access level from having access to !online, for example, while allowing temporary guests in the org chat to use the command.

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.