johnmaguire / Cardinal

A Python IRC bot, designed to make adding functionality quick and simple. (est. 2013)
MIT License
100 stars 38 forks source link

Option to restrict urls.detection events to specific desired plugins? #188

Closed lailoken503 closed 3 years ago

lailoken503 commented 3 years ago

I have the bot in a channel where members pastes youtube link, and Cardinal handle those pasted links very well: it shows the title, views and all that stuff. It's great.

But, it relies on the urls plugin for the urls.detection event, and we cannot seem to get the urls plugin to not listen for anything else BUT the youtube links. For example, if someone pastes a link to a CNN article, urls kicks in and lists the title of the article. Handy, for some, I suppose, but not necessarily a desired trait, at least, in our case.

Is there a way to have urls.detection only fire on youtube links and nothing else? Perhaps a settings in urls config,json?

johnmaguire commented 3 years ago

I've just pushed a commit and a new release 3.2.1 which adds an option handle_generic_urls boolean to the urls config.json. Hope that helps!

lailoken503 commented 3 years ago

I've just pushed a commit and a new release 3.2.1 which adds an option handle_generic_urls boolean to the urls config.json. Hope that helps!

Not sure why but the youtube plugin isn't firing at all, all I see are cardinal | 2021-04-19 01:49:21,579 - cardinal.bot - DEBUG - lailoken503!~lailo@i.welcome.our.palmtop.tiger.supreme.overlord to #lailoken: https://youtube.com/watch?v=etAIpkdhU9Q cardinal | 2021-04-19 01:49:21,579 - cardinal.plugins - DEBUG - Attempting to fire event: irc.privmsg cardinal | 2021-04-19 01:49:21,579 - cardinal.plugins - DEBUG - Calling 1 callbacks for event: irc.privmsg cardinal | 2021-04-19 01:49:21,581 - cardinal.plugins - DEBUG - Callback LSGMKU accepted event 'irc.privmsg' Not sure what I'm doing wrong, but I have "handle_generic_urls": false set in plugins\urls\config.json

johnmaguire commented 3 years ago

Can you tell me what plugins you have in your main config file?

lailoken503 commented 3 years ago

Can you tell me what plugins you have in your main config file?

"plugins": [ "admin", "google", "help", "join_on_invite", "movies", "ping", "seen", "tv", "urbandict", "weather", "wolframalpha", "youtube" ],

lailoken503 commented 3 years ago

Can you tell me what plugins you have in your main config file?

"plugins": [ "admin", "google", "help", "join_on_invite", "movies", "ping", "seen", "tv", "urbandict", "weather", "wolframalpha", "youtube" ],

D'oh.

lailoken503 commented 3 years ago

Can you tell me what plugins you have in your main config file?

"plugins": [ "admin", "google", "help", "join_on_invite", "movies", "ping", "seen", "tv", "urbandict", "weather", "wolframalpha", "youtube" ],

D'oh.

Thats what I get for trying to fix stuff in the middle of a screaming kids birthday party after a long day at work and getting my first covid-19 shot. Everything's working as expected, I somehow removed the urls plugin when I was removing the other unwanted plugins.

johnmaguire commented 3 years ago

No worries, cheers!