Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
errbot-unicode
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IRC Team
Errbot Development
errbot-unicode
Commits
370fcc43
Commit
370fcc43
authored
8 years ago
by
Bruce Cowan
Browse files
Options
Downloads
Patches
Plain Diff
A couple more functions in Unicode plugin
parent
2c881945
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
unicode.py
+25
-1
25 additions, 1 deletion
unicode.py
with
25 additions
and
1 deletion
unicode.py
+
25
−
1
View file @
370fcc43
import
unicodedata
from
errbot
import
BotPlugin
,
botcmd
...
...
@@ -21,4 +23,26 @@ class Unicode(BotPlugin):
try
:
return
''
.
join
([
chr
(
int
(
i
))
for
i
in
args
.
split
()])
except
ValueError
as
e
:
return
"
Error: {}
"
.
format
(
e
)
return
"
**Error**: {}
"
.
format
(
e
)
@botcmd
def
unicode_lookup
(
self
,
message
,
args
):
"""
Looks up a character by name
"""
if
not
args
:
return
"
**Usage**: !unicode lookup <name>
"
try
:
return
"
Character is {}
"
.
format
(
unicodedata
.
lookup
(
args
))
except
KeyError
:
return
"
**Error**: Character not found
"
@botcmd
def
unicode_name
(
self
,
message
,
args
):
"""
Looks up the name of a character
"""
if
len
(
args
)
!=
1
:
return
"
**Usage**: !unicode name <chr>
"
try
:
return
"
Character
'
s name is {}
"
.
format
(
unicodedata
.
name
(
args
))
except
ValueError
:
return
"
**Error**: Character not found
"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment