From a6e3343b4ca1b2d7833953228c52b9a4bba73867 Mon Sep 17 00:00:00 2001 From: Vivaan Parashar Date: Tue, 13 Apr 2021 18:11:42 +0530 Subject: use emojis and limit tags to 3 --- bot/constants.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'bot/constants.py') diff --git a/bot/constants.py b/bot/constants.py index bb538487..6c114180 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -201,6 +201,11 @@ class Emojis: status_dnd = "<:status_dnd:470326272082313216>" status_offline = "<:status_offline:470326266537705472>" + stackoverflow_upvote = environ.get('stack_upvote', "<:stack_upvote:831468823320330270>") + stackoverflow_tag = environ.get('stack_tag', "<:stack_tag:831468691647889419> ") + stackoverflow_views = environ.get('stack_views', "<:stack_eye:831455489040318464>") + stackoverflow_ans = environ.get('stack_ans', "<:stack_ans:831455489195638784>") + class Icons: questionmark = "https://cdn.discordapp.com/emojis/512367613339369475.png" -- cgit v1.2.3 From 7a22098801065d8ffcc5ea38d854ebaff0965b52 Mon Sep 17 00:00:00 2001 From: Vivaan Parashar Date: Tue, 13 Apr 2021 18:28:20 +0530 Subject: Update emojis --- bot/constants.py | 8 ++++---- bot/exts/evergreen/stackoverflow.py | 4 +--- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'bot/constants.py') diff --git a/bot/constants.py b/bot/constants.py index 6c114180..05eea474 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -201,10 +201,10 @@ class Emojis: status_dnd = "<:status_dnd:470326272082313216>" status_offline = "<:status_offline:470326266537705472>" - stackoverflow_upvote = environ.get('stack_upvote', "<:stack_upvote:831468823320330270>") - stackoverflow_tag = environ.get('stack_tag', "<:stack_tag:831468691647889419> ") - stackoverflow_views = environ.get('stack_views', "<:stack_eye:831455489040318464>") - stackoverflow_ans = environ.get('stack_ans', "<:stack_ans:831455489195638784>") + stackoverflow_upvote = environ.get('stack_upvote', "<:stack_upvote:*>") # TODO: Fill in numbers (ids) + stackoverflow_tag = environ.get('stack_tag', "<:stack_tag:*> ") + stackoverflow_views = environ.get('stack_views', "<:stack_eye:*>") + stackoverflow_ans = environ.get('stack_ans', "<:stack_ans:*>") class Icons: diff --git a/bot/exts/evergreen/stackoverflow.py b/bot/exts/evergreen/stackoverflow.py index 316c1ad7..04126d9c 100644 --- a/bot/exts/evergreen/stackoverflow.py +++ b/bot/exts/evergreen/stackoverflow.py @@ -82,7 +82,5 @@ def setup(bot: commands.Bot) -> None: """Loads Stackoverflow Cog.""" bot.add_cog(Stackoverflow(bot)) -# View icon made by Gregor Cresnar (https://www.flaticon.com/authors/gregor-cresnar) from www.flaticon.com, and edited -# by me -# Answer icon made by Prosymbols (https://www.flaticon.com/authors/prosymbols) from www.flaticon.com, and edited by me +# Upvote and Comment icon taken from Reddit bot # Tag icon made by Freepik (https://www.flaticon.com/authors/freepik) from www.flaticon.com, and edited by me -- cgit v1.2.3 From 9e89102f7061e0645563de7333fd162e431e53ef Mon Sep 17 00:00:00 2001 From: Vivaan Parashar Date: Mon, 7 Jun 2021 20:52:23 +0530 Subject: Use reddit emojis for upvote and answers --- bot/constants.py | 4 ++-- bot/exts/evergreen/stackoverflow.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'bot/constants.py') diff --git a/bot/constants.py b/bot/constants.py index aa26be83..1c62e78b 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -222,10 +222,10 @@ class Emojis: status_offline = "<:status_offline:470326266537705472>" - stackoverflow_upvote = environ.get('stack_upvote', "<:stack_upvote:*>") # TODO: Fill in numbers (ids) + # stackoverflow_upvote = environ.get('stack_upvote', "<:stack_upvote:*>") # TODO: Fill in numbers (ids) stackoverflow_tag = environ.get('stack_tag', "<:stack_tag:*> ") stackoverflow_views = environ.get('stack_views', "<:stack_eye:*>") - stackoverflow_ans = environ.get('stack_ans', "<:sta + # stackoverflow_ans = environ.get('stack_ans', "<:sta") # Reddit emojis reddit = "<:reddit:676030265734332427>" diff --git a/bot/exts/evergreen/stackoverflow.py b/bot/exts/evergreen/stackoverflow.py index e97e0318..45dcb62a 100644 --- a/bot/exts/evergreen/stackoverflow.py +++ b/bot/exts/evergreen/stackoverflow.py @@ -64,9 +64,9 @@ class Stackoverflow(commands.Cog): embed.add_field( name=unescape(item['title']), value=( - f"[{Emojis.stackoverflow_upvote} {item['score']} " + f"[{Emojis.reddit_upvote} {item['score']} " f"{Emojis.stackoverflow_views} {item['view_count']} " - f"{Emojis.stackoverflow_ans} {item['answer_count']} " + f"{Emojis.reddit_comments} {item['answer_count']} " f"{Emojis.stackoverflow_tag} {', '.join(item['tags'][:3])}]" f"({item['link']})" ), -- cgit v1.2.3 From 4374931d78dc1e3c8a6a361c6f78da4a9237a20d Mon Sep 17 00:00:00 2001 From: Vivaan Parashar Date: Wed, 9 Jun 2021 22:16:12 +0530 Subject: Remove commented emojis --- bot/constants.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'bot/constants.py') diff --git a/bot/constants.py b/bot/constants.py index fa5dc2bc..25545c04 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -225,10 +225,8 @@ class Emojis: status_offline = "<:status_offline:470326266537705472>" - # stackoverflow_upvote = environ.get('stack_upvote', "<:stack_upvote:*>") # TODO: Fill in numbers (ids) stackoverflow_tag = environ.get('stack_tag', "<:stack_tag:*> ") stackoverflow_views = environ.get('stack_views', "<:stack_eye:*>") - # stackoverflow_ans = environ.get('stack_ans', "<:sta") # Reddit emojis reddit = "<:reddit:676030265734332427>" -- cgit v1.2.3 From 32a4b6ac1c52381520de9dbf36be7f2f2be95bec Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 9 Jun 2021 22:24:18 +0100 Subject: Update Github emoji to new icons Github updated their icons, so we should update ours too. Co-authored-by: GDWR --- bot/constants.py | 14 ++++++++------ bot/exts/evergreen/issues.py | 6 +++--- 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'bot/constants.py') diff --git a/bot/constants.py b/bot/constants.py index f7fe216b..798cb950 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -190,12 +190,14 @@ class Emojis: dice_5 = "<:dice_5:755891608091885627>" dice_6 = "<:dice_6:755891607680843838>" - issue = "<:IssueOpen:629695470327037963>" - issue_closed = "<:IssueClosed:629695470570307614>" - pull_request = "<:PROpen:629695470175780875>" - pull_request_closed = "<:PRClosed:629695470519713818>" - pull_request_draft = "<:PRDraft:829755345425399848>" - merge = "<:PRMerged:629695470570176522>" + # These icons are from Github's repo https://github.com/primer/octicons/ + issue_opened = "<:IssueOpen:852294683731165184>" + issue_closed = "<:IssueClosed:852294683723694140>" + issue_draft = "<:IssueDraft:852294683592884284>" # Not currently used by Github, but here for future. + pull_request_open = "<:PROpen:629695470175780875>" + pull_request_closed = "<:PRClosed:852294683194294304>" + pull_request_draft = "<:PRDraft:852294683861712916>" + pull_request_merge = "<:PRMerged:629695470570176522>" number_emojis = { 1: "\u0031\ufe0f\u20e3", diff --git a/bot/exts/evergreen/issues.py b/bot/exts/evergreen/issues.py index b67aa4a6..da10047e 100644 --- a/bot/exts/evergreen/issues.py +++ b/bot/exts/evergreen/issues.py @@ -135,7 +135,7 @@ class Issues(commands.Cog): # need from the initial API call. if "issues" in json_data["html_url"]: if json_data.get("state") == "open": - emoji = Emojis.issue + emoji = Emojis.issue_opened else: emoji = Emojis.issue_closed @@ -149,10 +149,10 @@ class Issues(commands.Cog): if pull_data["draft"]: emoji = Emojis.pull_request_draft elif pull_data["state"] == "open": - emoji = Emojis.pull_request + emoji = Emojis.pull_request_open # When 'merged_at' is not None, this means that the state of the PR is merged elif pull_data["merged_at"] is not None: - emoji = Emojis.merge + emoji = Emojis.pull_request_merge else: emoji = Emojis.pull_request_closed -- cgit v1.2.3 From 07a8f19be4f1178cca26330d68c778717d267415 Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 9 Jun 2021 23:03:55 +0100 Subject: Update tense of icon constants This is so the name of the constants describe the state in the correct tense Co-authored-by: Numerlor --- bot/constants.py | 4 ++-- bot/exts/evergreen/issues.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'bot/constants.py') diff --git a/bot/constants.py b/bot/constants.py index 798cb950..2c18f6e7 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -191,13 +191,13 @@ class Emojis: dice_6 = "<:dice_6:755891607680843838>" # These icons are from Github's repo https://github.com/primer/octicons/ - issue_opened = "<:IssueOpen:852294683731165184>" + issue_open = "<:IssueOpen:852294683731165184>" issue_closed = "<:IssueClosed:852294683723694140>" issue_draft = "<:IssueDraft:852294683592884284>" # Not currently used by Github, but here for future. pull_request_open = "<:PROpen:629695470175780875>" pull_request_closed = "<:PRClosed:852294683194294304>" pull_request_draft = "<:PRDraft:852294683861712916>" - pull_request_merge = "<:PRMerged:629695470570176522>" + pull_request_merged = "<:PRMerged:629695470570176522>" number_emojis = { 1: "\u0031\ufe0f\u20e3", diff --git a/bot/exts/evergreen/issues.py b/bot/exts/evergreen/issues.py index da10047e..00810de8 100644 --- a/bot/exts/evergreen/issues.py +++ b/bot/exts/evergreen/issues.py @@ -135,7 +135,7 @@ class Issues(commands.Cog): # need from the initial API call. if "issues" in json_data["html_url"]: if json_data.get("state") == "open": - emoji = Emojis.issue_opened + emoji = Emojis.issue_open else: emoji = Emojis.issue_closed @@ -152,7 +152,7 @@ class Issues(commands.Cog): emoji = Emojis.pull_request_open # When 'merged_at' is not None, this means that the state of the PR is merged elif pull_data["merged_at"] is not None: - emoji = Emojis.pull_request_merge + emoji = Emojis.pull_request_merged else: emoji = Emojis.pull_request_closed -- cgit v1.2.3 From dce6930c8be76c1f236247f41ca55ed07f590147 Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 10 Jun 2021 18:25:54 +0100 Subject: Add transparent border to new Github octicons --- bot/constants.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'bot/constants.py') diff --git a/bot/constants.py b/bot/constants.py index 2c18f6e7..7bd10b5f 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -191,13 +191,13 @@ class Emojis: dice_6 = "<:dice_6:755891607680843838>" # These icons are from Github's repo https://github.com/primer/octicons/ - issue_open = "<:IssueOpen:852294683731165184>" - issue_closed = "<:IssueClosed:852294683723694140>" - issue_draft = "<:IssueDraft:852294683592884284>" # Not currently used by Github, but here for future. - pull_request_open = "<:PROpen:629695470175780875>" - pull_request_closed = "<:PRClosed:852294683194294304>" - pull_request_draft = "<:PRDraft:852294683861712916>" - pull_request_merged = "<:PRMerged:629695470570176522>" + issue_open = "<:IssueOpen:852596024777506817>" + issue_closed = "<:IssueClosed:852596024739758081>" + issue_draft = "<:IssueDraft:852596025147523102>" # Not currently used by Github, but here for future. + pull_request_open = "<:PROpen:852596471505223781>" + pull_request_closed = "<:PRClosed:852596024732286976>" + pull_request_draft = "<:PRDraft:852596025045680218>" + pull_request_merged = "<:PRMerged:852596100301193227>" number_emojis = { 1: "\u0031\ufe0f\u20e3", -- cgit v1.2.3 From ce355662afd55a5adf95335bbb50058b3eeb7891 Mon Sep 17 00:00:00 2001 From: wookie184 Date: Tue, 6 Jul 2021 17:11:41 +0100 Subject: Allow commands in code jam team channels --- bot/constants.py | 1 + bot/utils/checks.py | 5 +++++ 2 files changed, 6 insertions(+) (limited to 'bot/constants.py') diff --git a/bot/constants.py b/bot/constants.py index 7bd10b5f..3b3d7711 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -127,6 +127,7 @@ class Categories(NamedTuple): media = 799054581991997460 staff = 364918151625965579 +codejam_categories_name = "Code Jam" # Name of the codejam team categories class Client(NamedTuple): name = "Sir Lancebot" diff --git a/bot/utils/checks.py b/bot/utils/checks.py index c06b6870..438ec750 100644 --- a/bot/utils/checks.py +++ b/bot/utils/checks.py @@ -75,6 +75,11 @@ def in_whitelist_check( log.trace(f"{ctx.author} may use the `{ctx.command.name}` command as they are in a whitelisted category.") return True + category = getattr(ctx.channel, "category", None) + if category and category.name == constants.codejam_categories_name: + log.trace(f"{ctx.author} may use the `{ctx.command.name}` command as they are in a codejam team channel.") + return True + # Only check the roles whitelist if we have one and ensure the author's roles attribute returns # an iterable to prevent breakage in DM channels (for if we ever decide to enable commands there). if roles and any(r.id in roles for r in getattr(ctx.author, "roles", ())): -- cgit v1.2.3 From 198d22cba0a641f96bd8d1e95a28205cf7df40de Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Tue, 6 Jul 2021 21:51:24 +0100 Subject: Remove hacktoberfest channel overrides The hacktoberfest channel has now been removed, so these overrides can also be removed. The commands may still be useful in future, and can be used in lancebot's playground. --- bot/constants.py | 1 - bot/exts/halloween/hacktoberstats.py | 8 ++------ 2 files changed, 2 insertions(+), 7 deletions(-) (limited to 'bot/constants.py') diff --git a/bot/constants.py b/bot/constants.py index 3b3d7711..ff901c8e 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -113,7 +113,6 @@ class Channels(NamedTuple): off_topic_1 = 463035241142026251 off_topic_2 = 463035268514185226 community_bot_commands = int(environ.get("CHANNEL_COMMUNITY_BOT_COMMANDS", 607247579608121354)) - hacktoberfest_2020 = 760857070781071431 voice_chat_0 = 412357430186344448 voice_chat_1 = 799647045886541885 staff_voice = 541638762007101470 diff --git a/bot/exts/halloween/hacktoberstats.py b/bot/exts/halloween/hacktoberstats.py index b74e680b..50d3aaf6 100644 --- a/bot/exts/halloween/hacktoberstats.py +++ b/bot/exts/halloween/hacktoberstats.py @@ -10,15 +10,14 @@ from async_rediscache import RedisCache from discord.ext import commands from bot.bot import Bot -from bot.constants import Channels, Colours, Month, NEGATIVE_REPLIES, Tokens, WHITELISTED_CHANNELS -from bot.utils.decorators import in_month, whitelist_override +from bot.constants import Colours, Month, NEGATIVE_REPLIES, Tokens +from bot.utils.decorators import in_month log = logging.getLogger(__name__) CURRENT_YEAR = datetime.now().year # Used to construct GH API query PRS_FOR_SHIRT = 4 # Minimum number of PRs before a shirt is awarded REVIEW_DAYS = 14 # number of days needed after PR can be mature -HACKTOBER_WHITELIST = WHITELISTED_CHANNELS + (Channels.hacktoberfest_2020,) REQUEST_HEADERS = {"User-Agent": "Python Discord Hacktoberbot"} # using repo topics API during preview period requires an accept header @@ -44,7 +43,6 @@ class HacktoberStats(commands.Cog): @in_month(Month.SEPTEMBER, Month.OCTOBER, Month.NOVEMBER) @commands.group(name="hacktoberstats", aliases=("hackstats",), invoke_without_command=True) - @whitelist_override(channels=HACKTOBER_WHITELIST) async def hacktoberstats_group(self, ctx: commands.Context, github_username: str = None) -> None: """ Display an embed for a user's Hacktoberfest contributions. @@ -72,7 +70,6 @@ class HacktoberStats(commands.Cog): @in_month(Month.SEPTEMBER, Month.OCTOBER, Month.NOVEMBER) @hacktoberstats_group.command(name="link") - @whitelist_override(channels=HACKTOBER_WHITELIST) async def link_user(self, ctx: commands.Context, github_username: str = None) -> None: """ Link the invoking user's Github github_username to their Discord ID. @@ -96,7 +93,6 @@ class HacktoberStats(commands.Cog): @in_month(Month.SEPTEMBER, Month.OCTOBER, Month.NOVEMBER) @hacktoberstats_group.command(name="unlink") - @whitelist_override(channels=HACKTOBER_WHITELIST) async def unlink_user(self, ctx: commands.Context) -> None: """Remove the invoking user's account link from the log.""" author_id, author_mention = self._author_mention_from_context(ctx) -- cgit v1.2.3 From 38add14229548d423d643d828063039010d00f80 Mon Sep 17 00:00:00 2001 From: Xithrius Date: Tue, 3 Aug 2021 14:31:59 -0700 Subject: Added emoji IDs to constants.py --- bot/constants.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bot/constants.py') diff --git a/bot/constants.py b/bot/constants.py index 0a3b874a..bb602361 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -227,8 +227,8 @@ class Emojis: status_offline = "<:status_offline:470326266537705472>" - stackoverflow_tag = environ.get('stack_tag', "<:stack_tag:*> ") - stackoverflow_views = environ.get('stack_views', "<:stack_eye:*>") + stackoverflow_tag = "<:stack_tag:870926975307501570>" + stackoverflow_views = "<:stack_eye:870926992692879371>" # Reddit emojis reddit = "<:reddit:676030265734332427>" -- cgit v1.2.3