aboutsummaryrefslogtreecommitdiffstats
path: root/bot
diff options
context:
space:
mode:
authorGravatar wookie184 <[email protected]>2022-08-02 18:01:27 +0100
committerGravatar GitHub <[email protected]>2022-08-02 18:01:27 +0100
commit57e5f9764dcc135166961747abcb883d6a06df7f (patch)
tree8f72d48beefe43c2566a19f6bb472b49537e0912 /bot
parentUpdated docstring for _ext_emoji_replace (diff)
parentGitHub issues embeds: preserve order and display repo name and issue number (... (diff)
Merge branch 'main' into uwu-emoji-fix
Diffstat (limited to 'bot')
-rw-r--r--bot/exts/fun/battleship.py4
-rw-r--r--bot/exts/fun/connect_four.py5
-rw-r--r--bot/exts/fun/fun.py10
-rw-r--r--bot/exts/utilities/githubinfo.py6
4 files changed, 18 insertions, 7 deletions
diff --git a/bot/exts/fun/battleship.py b/bot/exts/fun/battleship.py
index beff196f..77e38427 100644
--- a/bot/exts/fun/battleship.py
+++ b/bot/exts/fun/battleship.py
@@ -110,8 +110,8 @@ class Game:
self.gameover: bool = False
- self.turn: Optional[discord.Member] = None
- self.next: Optional[discord.Member] = None
+ self.turn: Optional[Player] = None
+ self.next: Optional[Player] = None
self.match: Optional[re.Match] = None
self.surrender: bool = False
diff --git a/bot/exts/fun/connect_four.py b/bot/exts/fun/connect_four.py
index f53695d5..1b88d065 100644
--- a/bot/exts/fun/connect_four.py
+++ b/bot/exts/fun/connect_four.py
@@ -5,6 +5,7 @@ from typing import Optional, Union
import discord
import emojis
+from discord import ClientUser, Member
from discord.ext import commands
from bot.bot import Bot
@@ -71,7 +72,9 @@ class Game:
await self.message.add_reaction(CROSS_EMOJI)
await self.message.edit(content=None, embed=embed)
- async def game_over(self, action: str, player1: discord.user, player2: discord.user) -> None:
+ async def game_over(
+ self, action: str, player1: Union[ClientUser, Member], player2: Union[ClientUser, Member]
+ ) -> None:
"""Announces to public chat."""
if action == "win":
await self.channel.send(f"Game Over! {player1.mention} won against {player2.mention}")
diff --git a/bot/exts/fun/fun.py b/bot/exts/fun/fun.py
index a27ad85f..9ec9b9ee 100644
--- a/bot/exts/fun/fun.py
+++ b/bot/exts/fun/fun.py
@@ -3,8 +3,9 @@ import logging
import random
from collections.abc import Iterable
from pathlib import Path
-from typing import Callable, Optional, Union
+from typing import Callable, Literal, Optional, Union
+import pyjokes
from discord import Embed, Message
from discord.ext import commands
from discord.ext.commands import BadArgument, Cog, Context, MessageConverter, clean_content
@@ -41,7 +42,6 @@ class Fun(Cog):
def __init__(self, bot: Bot):
self.bot = bot
-
self._caesar_cipher_embed = json.loads(Path("bot/resources/fun/caesar_info.json").read_text("UTF-8"))
@staticmethod
@@ -212,6 +212,12 @@ class Fun(Cog):
return Embed.from_dict(embed_dict)
+ @commands.command()
+ async def joke(self, ctx: commands.Context, category: Literal["neutral", "chuck", "all"] = "all") -> None:
+ """Retrieves a joke of the specified `category` from the pyjokes api."""
+ joke = pyjokes.get_joke(category=category)
+ await ctx.send(joke)
+
def setup(bot: Bot) -> None:
"""Load the Fun cog."""
diff --git a/bot/exts/utilities/githubinfo.py b/bot/exts/utilities/githubinfo.py
index 963f54e5..046f67df 100644
--- a/bot/exts/utilities/githubinfo.py
+++ b/bot/exts/utilities/githubinfo.py
@@ -149,7 +149,9 @@ class GithubInfo(commands.Cog):
for result in results:
if isinstance(result, IssueState):
- description_list.append(f"{result.emoji} [{result.title}]({result.url})")
+ description_list.append(
+ f"{result.emoji} [[{result.repository}] #{result.number} {result.title}]({result.url})"
+ )
elif isinstance(result, FetchError):
description_list.append(f":x: [{result.return_code}] {result.message}")
@@ -192,7 +194,7 @@ class GithubInfo(commands.Cog):
log.trace(f"Found {issues = }")
# Remove duplicates
- issues = set(issues)
+ issues = list(dict.fromkeys(issues))
if len(issues) > MAXIMUM_ISSUES:
embed = discord.Embed(