Skip to content

Commit 3e25e78

Browse files
WizardCMderrod
authored andcommitted
cogs.log_analysis: Use "Solutions" button rather than link in embed
This also bumps the discord-py-slash-command version.
1 parent c4bf535 commit 3e25e78

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

obsbot/cogs/public/log_analysis.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
from asyncio import TimeoutError
99
from discord import Message, Embed, Colour
1010
from discord.ext.commands import Cog, command, Context
11+
from discord_slash.utils.manage_components import create_button, create_actionrow
12+
from discord_slash.model import ButtonStyle
1113

1214
from .utils.ratelimit import RateLimiter
1315

@@ -164,17 +166,17 @@ def pretty_print_messages(msgs):
164166
embed.add_field(name='Hardware Check', inline=False,
165167
value=' / '.join(hardware_check_msg))
166168

167-
embed.add_field(name='Analyser Report', inline=False,
168-
value=f'[**Click here for solutions / full analysis**]({anal_url})')
169-
170169
# include filtered log in case SE or FTL spam is detected
171170
if 'obsproject.com' in log_url and any(elem in log_content for
172171
elem in self._filtered_log_needles):
173172
clean_url = log_url.replace('obsproject.com', 'obsbot.rodney.io')
174173
embed.description = f'*Log contains debug messages (browser/ftl/etc), ' \
175174
f'for a filtered version [click here]({clean_url})*\n'
176175

177-
return await msg.channel.send(embed=embed, reference=msg, mention_author=True)
176+
actions = create_actionrow(create_button(style=ButtonStyle.URL, url=anal_url,
177+
label=f'Solutions / Full Analysis'))
178+
179+
return await msg.channel.send(embed=embed, reference=msg, mention_author=True, components=[actions])
178180

179181
async def fetch_log_analysis(self, url):
180182
async with self.bot.session.get('https://obsproject.com/analyzer-api/',

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
asyncpg>=0.21.0
22
discord.py>=1.6.0
33
toml>=0.10.2
4-
discord-py-slash-command>=1.1.0
4+
discord-py-slash-command>=2.3.1
55
peony-twitter>=2.0.0
66
dateutils>0.6.0

0 commit comments

Comments
 (0)