As an AI language model, I cannot provide visual elements for installation, however, here are the steps to install jikanpy:
Open your terminal (Command Prompt on Windows or Terminal on Mac/Linux).
Make sure you have Python 3 installed on your system. You can check by running the command python3 --version.
Install jikanpy by running the command pip install jikanpy.
Verify that jikanpy has been installed correctly by running the command python3 -c "import jikanpy". If there are no error messages, the installation was successful.
Congratulations, you have successfully installed jikanpy!
User
Assistant
As an AI language model, I cannot test or debug code, but I have reviewed the code and it seems fine. However, keep in mind that you'll need to pass a valid bot token when calling the bot.start() method.
User
seems like i have an error on line 42 could see whats wrong
Assistant
Please provide the full error message that you received, as it will help me understand the issue better.
User
File "main.py", line 42
@bot.command()
^
IndentationError: expected an indented block after function definition on line 40
Assistant
The "IndentationError: expected an indented block after function definition on line 40" error means that there is a problem with the indentation of your code. In Python, indentation is used to indicate the level of nesting within the code. In this case, the error suggests that the line after line 40, which is line 41 needs to be indented with at least one space or a tab.
Here's an example of how you can fix this error:
code
import discord
from discord.ext import commands
from jikanpy import Jikan
import random
def names_compatibility(name1, name2):
score1 = sum(ord(c) for c in name1.lower())
score2 = sum(ord(c) for c in name2.lower())
random.seed(score1 * score2)
return random.randint(1, 100)
async def random_character_trivia():
popular_anime_id = random.choice([1, 16498, 5114, 30276, 11061]) # Random popular anime ID
character_list = jikan.anime(popular_anime_id, extension='characters_staff')['characters']
char = random.choice(character_list)
return char['name'], char['image_url']
@bot.command()
async def my_waifu(ctx):
user = ctx.message.author.id
waifu = waifus.get(user)
if waifu:
embed = discord.Embed(title=f"{ctx.message.author.mention}'s Waifu", description=waifu['name'], color=discord.Color.purple())
embed.set_thumbnail(url=waifu['image'])
embed.add_field(name='Anime', value=waifu['anime'], inline=True)
await ctx.send(embed=embed)
else:
await ctx.send(f"{ctx.message.author.mention} has not added a waifu.")
@bot.command()
async def my_husbando(ctx):
user = ctx.message.author.id
husbando = husbandos.get(user)
if husbando:
embed = discord.Embed(title=f"{ctx.message.author.mention}'s Husbando", description=husbando['name'], color=discord.Color.purple())
embed.set_thumbnail(url=husbando['image'])
embed.add_field(name='Anime', value=husbando['anime'], inline=True)
await ctx.send(embed=embed)
else:
await ctx.send(f"{ctx.message.author.mention} has not added a husbando.")
@bot.command()
async def compatibility(ctx, *, character_name: str):
user_name = ctx.message.author.name
compatibility_score = names_compatibility(user_name, character_name)
await ctx.send(f"{ctx.message.author.mention} has a {compatibility_score}% compatibility with {character_name}!")
@bot.command()
async def trivia(ctx):
character, image_url = await random_character_trivia()
await ctx.send(f"Trivia Time!\n\nGuess the character's name based on the image!\n{image_url}")
@bot.command()
async def roulette(ctx, *, anime_title: str):
global anime_roulette
anime_roulette.append(anime_title)
await ctx.send(f"Added {anime_title} to the roulette!")
@bot.command()
async def spin_roulette(ctx):
if not anime_roulette:
await ctx.send("The roulette is empty. Add an anime using the !roulette command.")
return
code
chosen_anime = random.choice(anime_roulette)
await ctx.send(f"The anime chosen from the roulette is: {chosen_anime}")
@bot.command()
async def create_watch_party(ctx, anime_title: str, datetime: str):
party = {
'title': anime_title,
'datetime': datetime,
'creator': ctx.message.author.mention
}
watch_parties.append(party)
await ctx.send(f"Watch Party created! {ctx.message.author.mention} scheduled '{anime_title}' for {datetime}.")
@bot.command()
async def list_watch_parties(ctx):
if not watch_parties:
await ctx.send("No upcoming watch parties.")
return
code
embed = discord.Embed(title="Upcoming Watch Parties", color=discord.Color.blue())
for party in watch_parties:
embed.add_field(name=party['title'], value=f"Date & Time: {party['datetime']}\nCreated by: {party['creator']}", inline=False)
await ctx.send(embed=embed)