Skip to content

Created a command for khlinks and lets dev team members select pr members #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
.vscode
git
__pycache__
cogs/__pycache__
*.pyc
*.log
6 changes: 3 additions & 3 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
from discord.ext import commands
import builtins

intents = discord.Intents.default()
intents.members = True
# intents = discord.Intents.default()
# intents.members = True

bot = commands.Bot(command_prefix = '!', activity = discord.Game('with the discord API!'), intents=intents)
bot = commands.Bot(command_prefix = '!', activity = discord.Game('with the discord API!'))
bot.remove_command('help')
builtins.bot = bot

Expand Down
28 changes: 28 additions & 0 deletions cogs/devselect.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import discord
from discord.ext import commands
import random
class Devselect(commands.Cog):
def __init__(self, bot):
self.bot = bot

@commands.command(aliases=["pr-reviewers", "pr-reviewer-select", "pr", "pr-review"])
@commands.has_role("Dev Team")
async def devselect(self, ctx, count, *names):
if(len(names) > count):
await ctx.send(
f"{ctx.author.mention}" + " please only use " + str(count) + " names for pr reviewers!"
)

elif(len(names) < count):
await ctx.send(
f"{ctx.author.mention}" + " please only use " + str(count) + " names for pr reviewers!"
)

pr_reviewers = ", ".join(random.choices(names, k = int(count)))
await ctx.send(
f"{ctx.author.mention}"
)
await ctx.send("PR reviewers selected from list are: " + pr_reviewers)

def setup(bot):
bot.add_cog(Devselect(bot))
1 change: 1 addition & 0 deletions cogs/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ async def help(self, ctx):
embed.add_field(name='whois', value='Displays the specified user\'s info. If no user is tagged, displays the author\'s info.')
embed.add_field(name='pfp', value='Displays the specified user\'s profile picture.')
embed.add_field(name='server / serverstats / stats / info', value='Displays server info.', inline=False)
embed.add_field(name='links / membership-dues / feedback / fees / ops', value = 'Displays various important KnightHacks links')
embed.add_field(name='weather', value='Displays specified city\'s current weather.', inline=False)
embed.add_field(name='cat', value='Displays a random cat.')
embed.add_field(name='dog', value='Displays a random dog.')
Expand Down
24 changes: 24 additions & 0 deletions cogs/links.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import discord
from discord.ext import commands
class Links(commands.Cog):
def __init__(self, bot):
self.bot = bot

@commands.command(aliases=["links", "membership-dues", "feedback", "fees", "ops"])
async def khlinks(self, ctx):
links = ("[Find current events happening this week!](https://knighthacks.org/linktree)" +
"\n\n[Pay your dues](https://knighthacks.org/dues)\n\n" +
"[Give feedback on a specific workshop](https://knighthacks.org/feedback)\n\n" +
"[Sign up to be a Knight Hacks club member](https://knighthacks.org/membership)\n\n" +
"[Come to our ops meeting](https://knighthacks.org/ops)")

await ctx.send(
f"{ctx.author.mention}"
)
embed = discord.Embed(color=0x7ce4f7, timestamp=ctx.message.created_at)
embed.add_field(name="KnightHacks links", value=links)
embed.set_thumbnail(url = "https://github.com/lienne/ModiBot/blob/master/cogs/img/headphonesdog.png?raw=true")
await ctx.send(embed=embed)

def setup(bot):
bot.add_cog(Links(bot))