Skip to content

Commit

Permalink
Merge pull request #326 from Laogeodritt/release/2.4.0
Browse files Browse the repository at this point in the history
v2.4.0
  • Loading branch information
Laogeodritt authored Oct 26, 2020
2 parents f095693 + 8eda56a commit 9c0f548
Show file tree
Hide file tree
Showing 33 changed files with 1,538 additions and 265 deletions.
7 changes: 7 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 20 additions & 4 deletions config.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"core": {
"name": "KazTronExampleBot",
"extensions": ["welcome", "wordfilter", "dice", "modtools", "spotlight", "modnotes", "reminder", "sprint", "quotedb", "voicelog"],
"extensions": ["dice", "discordtools", "fuck", "modnotes", "modnotes.bantools", "modnotes.jointools","modtools", "quotedb", "reminder", "resource_channel", "spotlight", "sprint", "sticky", "test", "userstats", "voicelog", "welcome", "wordfilter"],
"channel_request": "channel ID for requests",
"info_links": {
"link name 1": "http://potato.example/url/to/something",
Expand Down Expand Up @@ -113,12 +113,16 @@
"channel_warning": "channel ID for MODERATOR filter warning/delete notifications"
},
"modnotes": {
"channel_log": "channel ID - for channel to log all new records to (read-only ideally?)"
"channel_log": "channel ID - for channel to log all new records to (read-only ideally?)",
"channel_mod": "channel ID for notifications to mods (used by extensions)",
"ban_check_interval": 3600,
"ban_role": "role name for banned members",
"ban_temp_enforce": false,
"ban_perma_enforce": false,
"ban_temp_expires": "in 7 days"
},
"modtools": {
"tempban_role": "Role Name Here",
"notif_role": "Name of role used to send notifications to all mods",
"channel_mod": "ID of channel for mod notifications (like timed unbans)",
"distinguish_map": {
"mod-role1": "distinguish-role1",
"mod-role2": "distinguish-role2"
Expand Down Expand Up @@ -148,6 +152,15 @@
"renew_limit": 25,
"renew_interval_min": 600
},
"resource_channel": {
"channel": "Channel ID",
"reactions": ["\uD83D\uDC4D", "\uD83D\uDC4E"],
"allow_strings": ["https://", "http://"],
"allow_re_strings": [],
"deny_strings": [],
"deny_re_strings": [],
"allow_uploads": true
},
"spotlight": {
"name": "World Spotlight",
"channel": "Channel ID",
Expand All @@ -174,6 +187,9 @@
"finalize_time": 300,
"report_time": "time at which reports are generated weekly, default 17:00"
},
"sticky": {
"delay": 300
},
"userstats": {
"ignore_users": ["user ID 1", "user ID 2", "etc"],
"ignore_channels": ["channel ID 1", "channel ID 2", "etc"]
Expand Down
4 changes: 2 additions & 2 deletions kaztron/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from .kazcog import KazCog
from .scheduler import Scheduler, TaskInstance, task

__release__ = "2.3" # release stream, usually major.minor only
__version__ = "2.3.4"
__release__ = "2.4" # release stream, usually major.minor only
__version__ = "2.4.0"

bot_info = {
"version": __version__,
Expand Down
2 changes: 1 addition & 1 deletion kaztron/cog/blots/badges.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def __init__(self, bot):
async def on_ready(self):
await super().on_ready()
channel_id = self.config.get('blots', 'badge_channel')
self.channel = self.validate_channel(channel_id)
self.channel = self.get_channel(channel_id)
self.c = BlotsBadgeController(self.server, self.config)

def export_kazhelp_vars(self):
Expand Down
2 changes: 1 addition & 1 deletion kaztron/cog/blots/checkin.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def export_kazhelp_vars(self):

async def on_ready(self):
await super().on_ready()
self.check_in_channel = self.validate_channel(self.check_in_channel_id)
self.check_in_channel = self.get_channel(self.check_in_channel_id)
self.checkin_anytime_roles = tuple(get_named_role(self.server, n)
for n in self.cog_config.check_in_window_exempt_roles)
milestone_map = {}
Expand Down
2 changes: 1 addition & 1 deletion kaztron/cog/dice.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Dice(KazCog):
def __init__(self, bot):
super().__init__(bot, 'dice', DiceConfig)
self.cog_config.set_converters('channel_dice',
lambda cid: self.validate_channel(cid),
lambda cid: self.get_channel(cid),
lambda _: None)
self.ch_dice = None

Expand Down
80 changes: 80 additions & 0 deletions kaztron/cog/discordtools.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import logging
from datetime import datetime

from discord.ext import commands

from kaztron import KazCog
from kaztron.utils.checks import mod_only, mod_channels
from kaztron.utils.datetime import format_datetime
from kaztron.utils.discord import channel_mention

logger = logging.getLogger(__name__)


class DiscordTools(KazCog):
"""!kazhelp
category: Commands
brief: Various tools to help with Discord.
description:
contents:
- kaztime
- id
- rchid
"""

def __init__(self, bot):
super().__init__(bot)

@commands.command(pass_context=True, ignore_extra=True, no_pm=False)
async def id(self, ctx: commands.Context):
"""!kazhelp
description: Gets your own user ID.
parameters: []
examples:
- command: .id
description: Gets your own user ID.
"""
await self.send_message(ctx.message.channel, ctx.message.author.mention +
" Your ID is: " + ctx.message.author.id)

@commands.command(pass_context=True, ignore_extra=True, no_pm=False, aliases=['now', 'time'])
async def kaztime(self, ctx: commands.Context):
"""!kazhelp
description: "Gets the current KazTron Time (UTC, GMT). Can be used to help convert
community programme schedules to your timezone."
parameters: []
examples:
- command: .kaztime
description: Shows the current time.
"""
await self.send_message(ctx.message.channel, ctx.message.author.mention +
"Current KazTime: {} UTC".format(format_datetime(datetime.utcnow(), seconds=True)))

@commands.command(pass_context=True, ignore_extra=True, no_pm=False)
@mod_only()
@mod_channels()
async def rchid(self, ctx: commands.Context, *, ids: str):
"""!kazhelp
description: Convert channel IDs to channel links.
details: "This command is primarily intended for bot operators to help in validating
the configuration file."
parameters:
- name: ids
type: str
description: "A list of channel IDs. They may be comma- or line-separated and may or
may not be quoted, using either double or single quotes."
examples:
- command: |
.rchid "123456789012345678", "876543210987654321"
description: Translates these two IDs into channel names, e.g., #general, #potato.
"""
ids_list = [s.strip().strip(r"'\"[]{}") for s in ids.replace(',', '\n').splitlines()]
await self.send_message(ctx.message.channel, ctx.message.author.mention + "\n" +
'\n'.join(channel_mention(cid) for cid in ids_list))


def setup(bot):
bot.add_cog(DiscordTools(bot))
2 changes: 1 addition & 1 deletion kaztron/cog/modnotes/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .modnotes import ModNotes
from .modnotes import ModNotes, ModNotesConfig
from .controller import init_db


Expand Down
Loading

0 comments on commit 9c0f548

Please sign in to comment.