Handle if no module found for bots (#564)
Co-authored-by: Taranjeet Singh <reachtotj@gmail.com>
This commit is contained in:
@@ -2,14 +2,21 @@ import argparse
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import discord
|
|
||||||
from discord import app_commands
|
|
||||||
from discord.ext import commands
|
|
||||||
|
|
||||||
from embedchain.helper.json_serializable import register_deserializable
|
from embedchain.helper.json_serializable import register_deserializable
|
||||||
|
|
||||||
from .base import BaseBot
|
from .base import BaseBot
|
||||||
|
|
||||||
|
try:
|
||||||
|
import discord
|
||||||
|
from discord import app_commands
|
||||||
|
from discord.ext import commands
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
raise ModuleNotFoundError(
|
||||||
|
"The required dependencies for Discord are not installed."
|
||||||
|
'Please install with `pip install "embedchain[discord]"`'
|
||||||
|
) from None
|
||||||
|
|
||||||
|
|
||||||
intents = discord.Intents.default()
|
intents = discord.Intents.default()
|
||||||
intents.message_content = True
|
intents.message_content = True
|
||||||
client = discord.Client(intents=intents)
|
client = discord.Client(intents=intents)
|
||||||
|
|||||||
@@ -3,12 +3,17 @@ import logging
|
|||||||
import os
|
import os
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
from fastapi_poe import PoeBot, run
|
|
||||||
|
|
||||||
from embedchain.helper.json_serializable import register_deserializable
|
from embedchain.helper.json_serializable import register_deserializable
|
||||||
|
|
||||||
from .base import BaseBot
|
from .base import BaseBot
|
||||||
|
|
||||||
|
try:
|
||||||
|
from fastapi_poe import PoeBot, run
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
raise ModuleNotFoundError(
|
||||||
|
"The required dependencies for Poe are not installed." 'Please install with `pip install "embedchain[poe]"`'
|
||||||
|
) from None
|
||||||
|
|
||||||
|
|
||||||
def start_command():
|
def start_command():
|
||||||
parser = argparse.ArgumentParser(description="EmbedChain PoeBot command line interface")
|
parser = argparse.ArgumentParser(description="EmbedChain PoeBot command line interface")
|
||||||
|
|||||||
Reference in New Issue
Block a user