Add lmgtfy
All checks were successful
Build and Publish Jimmy.2 / build_and_publish (push) Successful in 16s
All checks were successful
Build and Publish Jimmy.2 / build_and_publish (push) Successful in 16s
This commit is contained in:
parent
d610b8ba78
commit
dc4364c9f3
1 changed files with 8 additions and 1 deletions
|
@ -6,7 +6,7 @@ import logging
|
|||
import pathlib
|
||||
import subprocess
|
||||
import tempfile
|
||||
from urllib.parse import urlparse, ParseResult
|
||||
from urllib.parse import urlparse, ParseResult, quote_plus
|
||||
|
||||
import aiohttp
|
||||
import discord
|
||||
|
@ -32,6 +32,7 @@ class AutoResponder(commands.Cog):
|
|||
"overrule_offline_superiors is enabled, however presences intent is not!"
|
||||
)
|
||||
self.config.setdefault("transcoding", {"enabled": True, "hevc": True, "on_demand": True})
|
||||
self.lmgtfy_cache = []
|
||||
|
||||
@property
|
||||
def transcoding_enabled(self) -> bool:
|
||||
|
@ -365,6 +366,12 @@ class AutoResponder(commands.Cog):
|
|||
extra = [attachment.url for attachment in reaction.message.attachments]
|
||||
if self.allow_on_demand_transcoding:
|
||||
await self.transcode_hevc_to_h264(reaction.message, additional=extra)
|
||||
if isinstance(reaction.emoji, (discord.PartialEmoji, discord.Emoji)):
|
||||
if reaction.emoji.name == "google_it" and reaction.message.id not in self.lmgtfy_cache:
|
||||
await reaction.message.reply(
|
||||
"https://letmegooglethat.com/?q=" + quote_plus(reaction.message.content)
|
||||
)
|
||||
self.lmgtfy_cache.append(reaction.message.id)
|
||||
|
||||
@commands.Cog.listener("on_raw_reaction_add")
|
||||
async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent):
|
||||
|
|
Loading…
Reference in a new issue