Compare commits
No commits in common. "0664529c7014658a87a910870b9316f5cf4c15aa" and "6c919081c73c94f7dc49273c7bd6b83cbda92ba7" have entirely different histories.
0664529c70
...
6c919081c7
4 changed files with 16 additions and 38 deletions
|
|
@ -6,8 +6,9 @@ import utils as u
|
||||||
def setup(bot: bot.Bot):
|
def setup(bot: bot.Bot):
|
||||||
@bot.command(name="echo")
|
@bot.command(name="echo")
|
||||||
async def echo(ctx: nerimity.Context, *text: str):
|
async def echo(ctx: nerimity.Context, *text: str):
|
||||||
if not bot.is_owner(ctx.author): return
|
if not bot.is_owner(ctx.author):
|
||||||
|
print("returned")
|
||||||
|
return
|
||||||
if not text:
|
if not text:
|
||||||
await ctx.send(u.error_msg("Contents are empty."))
|
await ctx.send(u.error_msg("Contents are empty."))
|
||||||
return
|
return
|
||||||
|
|
@ -19,7 +20,9 @@ def setup(bot: bot.Bot):
|
||||||
|
|
||||||
@bot.command(name="servercount", aliases=["sc"])
|
@bot.command(name="servercount", aliases=["sc"])
|
||||||
async def servercount(ctx: nerimity.Context):
|
async def servercount(ctx: nerimity.Context):
|
||||||
if not bot.is_owner(ctx.author): return
|
if not bot.is_owner(ctx.author):
|
||||||
|
print("returned")
|
||||||
|
return
|
||||||
|
|
||||||
try: await ctx.send(f"I'm in {len(bot.servers)} servers!!")
|
try: await ctx.send(f"I'm in {len(bot.servers)} servers!!")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
@ -28,39 +31,19 @@ def setup(bot: bot.Bot):
|
||||||
|
|
||||||
@bot.command(name="post")
|
@bot.command(name="post")
|
||||||
async def post(ctx: nerimity.Context, *text: str):
|
async def post(ctx: nerimity.Context, *text: str):
|
||||||
if not bot.is_owner(ctx.author): return
|
if not bot.is_owner(ctx.author):
|
||||||
|
print("returned")
|
||||||
|
return
|
||||||
if not text:
|
if not text:
|
||||||
await ctx.send(u.error_msg("Contents are empty."))
|
await ctx.send(u.error_msg("Contents are empty."))
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await ctx.send(f"Creating post:\n```markdown\n{" ".join(text)}\n```")
|
await ctx.send(f"Creating post:\n```markdown\n{" ".join(text)}\n```")
|
||||||
|
# TODO: post removal command :p
|
||||||
post = nerimity.Post.create_post(content=" ".join(text))
|
# post = nerimity.Post.create_post(content=" ".join(text))
|
||||||
|
# print(post)
|
||||||
print(f"Posted: {post}")
|
|
||||||
await ctx.send(u.good_msg(f"Post created!!"))
|
await ctx.send(u.good_msg(f"Post created!!"))
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
print(e)
|
|
||||||
await ctx.send(u.error_msg(f"Unknown error:\n`{e}`"))
|
|
||||||
|
|
||||||
@bot.command(name="rmpost")
|
|
||||||
async def rmpost(ctx: nerimity.Context, post: str = None):
|
|
||||||
if not bot.is_owner(ctx.author): return
|
|
||||||
|
|
||||||
if not post:
|
|
||||||
await ctx.send(u.error_msg("No post ID provided."))
|
|
||||||
return
|
|
||||||
|
|
||||||
try:
|
|
||||||
post_id = int(post)
|
|
||||||
_post = nerimity.Post.get_post(post_id)
|
|
||||||
_post.delete_post()
|
|
||||||
|
|
||||||
await ctx.send("Deleted post.")
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
await ctx.send(u.error_msg(f"Unknown error:\n`{e}`"))
|
await ctx.send(u.error_msg(f"Unknown error:\n`{e}`"))
|
||||||
|
|
|
||||||
|
|
@ -15,13 +15,9 @@ async def send_collage(bot: bot.Bot, ctx: nerimity.Context, entity: str, size: s
|
||||||
await ctx.send(u.error_msg(f"Please provide a valid size.\nie `/chart{entity} 5x5`"))
|
await ctx.send(u.error_msg(f"Please provide a valid size.\nie `/chart{entity} 5x5`"))
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
if int(size.split('x')[0]) > 5 or int(size.split('x')[1]) > 5:
|
||||||
if int(size.split('x')[0]) > 5 or int(size.split('x')[1]) > 5:
|
await ctx.send(u.error_msg("Maximum size allowed is 5x5."))
|
||||||
await ctx.send(u.error_msg("Maximum size allowed is 5x5."))
|
return
|
||||||
return
|
|
||||||
|
|
||||||
except ValueError:
|
|
||||||
await ctx.send(u.error_msg(f"Please provide a valid size.\nie `/chart{entity} 5x5`"))
|
|
||||||
|
|
||||||
if not username:
|
if not username:
|
||||||
try: username = await bot.get_lastfm(ctx.author.id)
|
try: username = await bot.get_lastfm(ctx.author.id)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
prefix = "!"
|
|
||||||
token = "NerimityTokenHere"
|
token = "NerimityTokenHere"
|
||||||
owner_id = 1234567890
|
owner_id = 1234567890
|
||||||
api_key = "LastFmApiKeyHere"
|
api_key = "LastFmApiKeyHere"
|
||||||
|
|
|
||||||
2
main.py
2
main.py
|
|
@ -6,7 +6,7 @@ with open("config.toml", "rb") as f:
|
||||||
config = tomllib.load(f)
|
config = tomllib.load(f)
|
||||||
|
|
||||||
bot = bot.Bot(
|
bot = bot.Bot(
|
||||||
prefix = config['prefix'],
|
prefix = '!',
|
||||||
token = config['token'],
|
token = config['token'],
|
||||||
owner_id = config['owner_id'],
|
owner_id = config['owner_id'],
|
||||||
lastfm_api_key = config['api_key'],
|
lastfm_api_key = config['api_key'],
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue