Twentysix26 / 26-Cogs

General purpose cogs for Red (v2)
GNU General Public License v3.0
26 stars 43 forks source link

Triggers trigger on different bot #30

Closed LJack2k closed 6 years ago

LJack2k commented 7 years ago

Got redirected here because it seems its a trigger specific issue. While my understanding from a conversation in Discord was that Red in general doesn't listen to other bots. Anyway here again:

Yes I know that Red doesn't respond to other bots. And yes that's because you could have loops. But consider the following situation. I'm running several minecraft games that have their own bots (not red) as a bridge between minecraft and discord. I want to be able to create triggers that react on things that happen in the ingame chat. But this doesn't work because Red doesn't respond on other bots. Sadly. What could be a solution? Make it configurable so that by default the trigger doesn't respond, but when set to true it will respond on other bots. If there is paranoia for loops, its even possible to demand a 5 sec cooldown on a bot trigger, or higher. Or maybe to allow/disallow only certain bots. I think there are enough options to make this work and have it 'safe'.

I do love Red. Its serving us very well. Thanks for your hard work on it.

Twentysix26 commented 7 years ago

Red receives commands / read messages from bots. By design, we decide to filter out commands from bots, as all bots (should) do. Cogs that listen for incoming messages have to add additional checks to filter out the ones from bot. There is such a check in the trigger cog for obvious reasons, it's the type of cog that needs that the most.
I'm leaving this open, as I have some things to consider first.

Firazed commented 6 years ago

I made this change to my red.py file today. Not sure if it's the best way to handle it, but so far has worked for me.

def user_allowed(self, message):
        author = message.author

        if author.id == YOURIDHERE:
            return True

        if author.bot:
            return False
skeith commented 6 years ago

any changes to bot core files should be not okay

Firazed commented 6 years ago

Really? As an open source program I'm genuinely surprised. Do you have another suggestion for fixing my problem? I have a webhook to relay messages. Just trying to connect my streambot to my discord bot without having to code my own api wrapper. There are no existing api libraries compatible to my use. I did try the "hard way" but couldn't get my OP 2 to go through. No response at all, not even an error. Decided a "workaround" could be to use a webhook that doesnt require authorization to post to a private channel, have the red bot relay the message to the mentioned user. Was still planning on figuring this out but wanted something functional while I do so.

If this is true, please update the documentation.... the ReadMe file includes the following: "Red is a fully modular bot – meaning all features and commands can be enabled/disabled to your liking, making it completely customizable. "

skeith commented 6 years ago

The comment I made previously is for common end user who are not into coding. Customization can be done by cogs. Any edit to core files should be directed to Red DiscordBot GH as PR, while it's not always accepted, then it means you are on your own if you edited core files (as in you should know what you are doing). Because if you suggest that editing to a not tech savvy users and they ended up with issue, you are responsible for that.

Twentysix26 commented 6 years ago

Edit as you like, it's just a warning we remind to non-devs. It's a common occurrence for people to edit the code without really understanding what they're doing and then asking for help to fix the issues.
It's good practice to avoid core modifications as much as possible to preserve the ability to update and minimize issues with 3rd party cogs that rely on the core working on a certain way, but if you're aware and you're ok with this, no big deal.

LJack2k commented 6 years ago

Since this topic is still on open I would like to tell you that I would still like to have this option. I am aware of the dangers as I stated in the beginning. Could I be made in a way that only certain bots are listened to? That way we can limit is easily and still have it triggered from ingame.

skeith commented 6 years ago

That would be custom request which probably won't be published here

Twentysix26 commented 6 years ago

It's certainly technically possible however I'm not looking to implement this as I don't like the idea of processing bots' messages to begin with. Also, I think the use case for this is very narrow. You're welcome to try and do the edits on your own of course, it shouldn't be very hard (especially if you want to disable the bot check altogether)