mirror of
https://github.com/osmarks/autobotrobot
synced 2025-02-07 04:30:02 +00:00
Inevitable miscellaneous fixes
This commit is contained in:
parent
83074a743b
commit
3654aa30a0
@ -35,7 +35,7 @@ class GeneralCommands(commands.Cog):
|
||||
|
||||
@commands.command(help="Deletes the specified target.", rest_is_raw=True)
|
||||
async def delete(self, ctx, *, raw_target):
|
||||
target = await clean(self, ctx, raw_target.strip().replace("\n", " "))
|
||||
target = await clean(ctx, raw_target.strip().replace("\n", " "))
|
||||
if len(target) > 256:
|
||||
await ctx.send(embed=util.error_embed("Deletion target must be max 256 chars"))
|
||||
return
|
||||
@ -150,10 +150,10 @@ AutoBotRobot is operated by gollark/osmarks.
|
||||
for _ in range(lthing.count(negation)): weight = 1 / weight
|
||||
return weight
|
||||
|
||||
rng = default_rng()
|
||||
|
||||
@commands.command(help="'Randomly' choose between the specified options.", name="choice", aliases=["choose"])
|
||||
async def random_choice(self, ctx, *choices):
|
||||
rng = default_rng()
|
||||
choices = list(choices)
|
||||
samples = 1
|
||||
# apparently doing typing.Optional[int] doesn't work properly with this, so just bodge around it
|
||||
@ -178,4 +178,4 @@ AutoBotRobot is operated by gollark/osmarks.
|
||||
await ctx.send("\n".join(map(lambda x: f"{x[0]} x{x[1]}", results)))
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(GeneralCommands(bot))
|
||||
bot.add_cog(GeneralCommands(bot))
|
||||
|
@ -76,7 +76,10 @@ class Telephone(commands.Cog):
|
||||
while True:
|
||||
webhook, content, username, avatar_url = await self.webhook_queue.get()
|
||||
wh_obj = discord.Webhook.from_url(webhook, adapter=discord.AsyncWebhookAdapter(self.bot.http._HTTPClient__session))
|
||||
await wh_obj.send(content=content, username=username, avatar_url=avatar_url, allowed_mentions=discord.AllowedMentions(everyone=False, roles=False, users=False))
|
||||
try:
|
||||
await wh_obj.send(content=content, username=username, avatar_url=avatar_url, allowed_mentions=discord.AllowedMentions(everyone=False, roles=False, users=False))
|
||||
except:
|
||||
logging.exception("Webhook send on %s failed")
|
||||
|
||||
async def initial_load_webhooks(self):
|
||||
rows = await self.bot.database.execute_fetchall("SELECT * FROM discord_webhooks")
|
||||
|
Loading…
x
Reference in New Issue
Block a user