Skip to content

Commit a930039

Browse files
committed
add safeformat func
1 parent aaf2623 commit a930039

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
# v2.13.3
8+
9+
### Fixed
10+
- a typo in the config options
11+
712
# v2.13.2
813

914
### Fixed

core/utils.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
from discord import Object
66
from discord.ext import commands
77

8+
class SafeDict(dict):
9+
def __missing__(self, key):
10+
return '{' + key + '}'
11+
12+
def safeformat(str, **kwargs):
13+
replacements = SafeDict(**kwargs)
14+
return str.format_map(replacements)
815

916
class User(commands.IDConverter):
1017
"""

0 commit comments

Comments
 (0)