22 lines
897 B
Python
22 lines
897 B
Python
import discord
|
|
from discord.ext import commands
|
|
from core.text import split
|
|
NOTE="-# slow down, this rep was rate limited, if you still spam the rate limite will increase"
|
|
class Ctx(commands.Context):
|
|
limited=False
|
|
async def send(s,content=None,**kw):
|
|
kw.setdefault("mention_author",False)
|
|
text=None if content is None else str(content)
|
|
if s.limited:
|
|
text=f"{text}\n{NOTE}" if text else NOTE
|
|
parts=split(text,1900) if len(text)>2000 else [text]
|
|
else:parts=split(text) if text is not None and len(text)>2000 else [text]
|
|
m=None
|
|
for i,p in enumerate(parts):
|
|
k=kw if i==len(parts)-1 else {"mention_author":False}
|
|
try:m=await s.message.reply(p,**k)
|
|
except discord.HTTPException:
|
|
k.pop("mention_author",None);m=await s.channel.send(p,**k)
|
|
return m
|
|
reply=send
|