瀏覽代碼

v1.0.6 - added command to change avatar

master
Zac Herd 6 年之前
父節點
當前提交
9d000b4701
共有 2 個檔案被更改,包括 15 行新增2 行删除
  1. +14
    -1
      admincommands.py
  2. +1
    -1
      common.py

+ 14
- 1
admincommands.py 查看文件

@@ -12,6 +12,7 @@ import os
import asyncio
import subprocess
import discord
import urllib.request


# LOCAL IMPORTS
@@ -44,10 +45,22 @@ def cmd_loud(client, msg):
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
admincommands = {
"die": cmd_die,
"quiet": cmd_quiet,
"loud": cmd_loud,
}
"avatar": cmd_avatar,
}

+ 1
- 1
common.py 查看文件

@@ -13,7 +13,7 @@ import json


# bot version
version = "v1.0.5"
version = "v1.0.6"


# TODO: generate this on the fly and make it look acceptable


Loading…
取消
儲存