mirror of
https://github.com/osmarks/autobotrobot
synced 2025-02-07 12:40:00 +00:00
miscellaneous fixes
This commit is contained in:
parent
134a6e6e31
commit
c1b5007d33
@ -22,6 +22,7 @@ achievements = {
|
||||
}
|
||||
|
||||
async def achieve(bot: commands.Bot, message: discord.Message, achievement):
|
||||
if message.guild:
|
||||
guild_conf = await bot.database.execute_fetchone("SELECT achievement_messages FROM guild_config WHERE id = ?", (message.guild.id,))
|
||||
if guild_conf and guild_conf["achievement_messages"] == 0: return
|
||||
channel = message.channel
|
||||
|
@ -11,7 +11,7 @@ role_transfer_lock = asyncio.Lock()
|
||||
def setup(bot):
|
||||
@bot.listen()
|
||||
async def on_message(message):
|
||||
if message.guild.id == util.config["esoserver"]["id"]:
|
||||
if message.guild and message.guild.id == util.config["esoserver"]["id"]:
|
||||
async with role_transfer_lock: # prevent concurrency horrors - serialize accesses, probably
|
||||
for role in message.role_mentions:
|
||||
if role.id == util.config["esoserver"]["transfer_role"]: # transfer the role from sender to other pinged person
|
||||
|
@ -42,11 +42,14 @@ def setup(bot):
|
||||
|
||||
async def send_by_dm(info, text):
|
||||
user = bot.get_user(info["author_id"])
|
||||
if not user:
|
||||
user = await bot.fetch_user(info["author_id"])
|
||||
if not user: raise Exception(f"user {info['author_id']} unavailable/nonexistent")
|
||||
if not user.dm_channel: await user.create_dm()
|
||||
await user.dm_channel.send(text)
|
||||
|
||||
async def send_to_guild(info, text):
|
||||
if not "guild_id" in info: raise Exception("Guild unknown")
|
||||
guild = bot.get_guild(info["guild_id"])
|
||||
member = guild.get_member(info["author_id"])
|
||||
self = guild.get_member(bot.user.id)
|
||||
|
@ -21,7 +21,7 @@ def setup(bot):
|
||||
|
||||
@userdata.command(name="list", brief="List userdata keys in a given scope matching a query.")
|
||||
async def list_cmd(ctx, query="%", scope="guild", show_values: bool = False):
|
||||
"Lsit userdata keys in a given scope (guild/global) matching your query (LIKE syntax). Can also show the associated values."
|
||||
"List userdata keys in a given scope (guild/global) matching your query (LIKE syntax). Can also show the associated values."
|
||||
if scope == "global":
|
||||
rows = await bot.database.execute_fetchall("SELECT * FROM user_data WHERE user_id = ? AND guild_id = '_global' AND key LIKE ?", (ctx.author.id, query))
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user