-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
45 lines (37 loc) · 1.42 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import discord
import os
from dotenv import load_dotenv
from discord.ext import commands
from utility import *
load_dotenv()
#Sets intents
intents = discord.Intents.default()
intents.message_content = True
intents.members = True
#Some basic setup. Help command is disabled to allow custom one to work properly
token = os.getenv('TOKEN')
save_path = os.getenv('SAVE_PATH')
prefix = os.getenv('PREFIX')
bot = commands.Bot(command_prefix=prefix, description="URN Downloader", intents=intents, help_command=None)
#Login status message
@bot.event
async def on_ready():
print("Bot started. Logged in as {0.user}".format(bot))
#Main download command
@bot.command()
async def d(ctx, *args):
if len(ctx.message.attachments) > 0:
await ctx.send("Attachments detected....attempting to download")
await retrieve_attachments(ctx.message, args)
else:
await ctx.send("No attachments have been provided")
#Help command w/ embed
@bot.command()
async def help(ctx):
embed=discord.Embed(title="DownlURNder Help", url="https://github.com/markjfannon/downlurnder",\
description="Use {}d alongside an MP3 attachment to use the download tool!".format(prefix), color=0x34BD19)
embed.add_field(name="Example Usage", value="{}d filename.mp3 filename".format(prefix))
embed.set_footer(text="DownlURNder: Making remote AP project submissions easy")
await ctx.send(embed=embed)
#Actually runs the thing
bot.run(token)