mirror of
https://github.com/MrDetonia/Maki.git
synced 2024-11-22 11:54:16 -05:00
v1.0.6 - added command to change avatar
This commit is contained in:
parent
b28ff3691d
commit
9d000b4701
@ -12,6 +12,7 @@ import os
|
|||||||
import asyncio
|
import asyncio
|
||||||
import subprocess
|
import subprocess
|
||||||
import discord
|
import discord
|
||||||
|
import urllib.request
|
||||||
|
|
||||||
|
|
||||||
# LOCAL IMPORTS
|
# LOCAL IMPORTS
|
||||||
@ -44,10 +45,22 @@ def cmd_loud(client, msg):
|
|||||||
quiet.pop(msg.server.id, None)
|
quiet.pop(msg.server.id, None)
|
||||||
|
|
||||||
|
|
||||||
|
@asyncio.coroutine
|
||||||
|
def cmd_avatar(client, msg):
|
||||||
|
# TODO: error-check
|
||||||
|
# unsafe, but admin command - use with care for now
|
||||||
|
url = msg.content[8:]
|
||||||
|
try:
|
||||||
|
response = urllib.request.urlopen(url)
|
||||||
|
imgdata = response.read()
|
||||||
|
yield from client.edit_profile(avatar=imgdata)
|
||||||
|
except:
|
||||||
|
yield from discord_send(client, msg, "Error updating avatar!")
|
||||||
|
|
||||||
# COMMAND HANDLING
|
# COMMAND HANDLING
|
||||||
admincommands = {
|
admincommands = {
|
||||||
"die": cmd_die,
|
"die": cmd_die,
|
||||||
"quiet": cmd_quiet,
|
"quiet": cmd_quiet,
|
||||||
"loud": cmd_loud,
|
"loud": cmd_loud,
|
||||||
|
"avatar": cmd_avatar,
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user