35 lines
846 B
Python
35 lines
846 B
Python
import nextcord as nc
|
|
from nextcord.ext import commands
|
|
from typing import Optional
|
|
import asyncio
|
|
import os
|
|
|
|
bot = commands.Bot()
|
|
|
|
@bot.event
|
|
async def on_ready():
|
|
print(f'We have logged in as {bot.user}')
|
|
|
|
@bot.slash_command(name="summarize", description="Summarize all or part of an article", dm_permission=True)
|
|
async def summarize(
|
|
interaction: nc.Interaction,
|
|
article: str,
|
|
part: Optional[str] = nc.SlashOption(required=False)
|
|
):
|
|
await interaction.response.defer(False, True)
|
|
|
|
await asyncio.sleep(5)
|
|
|
|
await interaction.followup.send(f"I'll summarize {article} for you {interaction.user}")
|
|
print("Will summarize article.")
|
|
|
|
def main():
|
|
# TODO: Import bot token from env
|
|
bot.run(os.environ["DISCORD_TOKEN"])
|
|
|
|
if __name__ == "__main__":
|
|
print("Handy Helper has Begun!")
|
|
main()
|
|
|
|
|