Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Tobotimus/Tobo-Cogs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: V3
Choose a base ref
...
head repository: glich-stream/Tobo-Cogs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: V3
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 5 commits
  • 1 file changed
  • 2 contributors

Commits on Jan 26, 2024

  1. Copy the full SHA
    fe3b1d7 View commit details

Commits on Feb 26, 2024

  1. Copy the full SHA
    9809339 View commit details
  2. Copy the full SHA
    b0c926a View commit details
  3. Copy the full SHA
    66beccc View commit details

Commits on Feb 27, 2024

  1. Merge pull request #1 from ahmedsiam0/message-on-vote

    Enable the reactkarma cog to send messages about giving/taking karmas
    Link- authored Feb 27, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    1766df9 View commit details
Showing with 14 additions and 3 deletions.
  1. +14 −3 reactkarma/reactkarma.py
17 changes: 14 additions & 3 deletions reactkarma/reactkarma.py
Original file line number Diff line number Diff line change
@@ -191,13 +191,24 @@ async def _check_reaction(
emoji = reaction.emoji
upvote = await self._is_upvote(guild, emoji)
if upvote is not None:
await self._add_karma(author, 1 if upvote == added else -1)
await self._add_karma(user, author, 1 if upvote == added else -1, reaction)

async def _add_karma(self, user: discord.User, amount: int):
settings = self.conf.user(user)
async def _add_karma(
self, voter: discord.User, candidate: discord.User,
amount: int, reaction: discord.Reaction,
):
settings = self.conf.user(candidate)
karma = await settings.karma()
await settings.karma.set(karma + amount)

voter_name = "{0}({1})".format(voter.display_name, voter.name)
candidate_name = "{0}({1})".format(candidate.display_name, candidate.name)
action = "gave a karma to" if amount == 1 else "took a karma from"

await reaction.message.channel.send(
"{0} {1} {2}.".format(voter_name, action, candidate_name)
)

async def _get_emoji_id(self, guild: discord.Guild, *, upvote: bool):
if upvote:
emoji = await self.conf.guild(guild).upvote()