Now Running the bot within __init__.py

pull/8/head
sgoudham 4 years ago
parent 61fe835ccc
commit f84666c5b5

@ -165,6 +165,12 @@ class Bot(commands.Bot):
# Start the background task(s) # Start the background task(s)
change_status.start() change_status.start()
# Run the bot, allowing it to come online
try:
self.run(API_TOKEN)
except discord.errors.LoginFailure as e:
print(e, "Login unsuccessful.")
# --------------------------------------------!Cache Section!------------------------------------------------------- # --------------------------------------------!Cache Section!-------------------------------------------------------
def store_cache(self, guildid, prefix, channel, rolespersist): def store_cache(self, guildid, prefix, channel, rolespersist):
@ -536,4 +542,4 @@ class Bot(commands.Bot):
await conn.commit() await conn.commit()
print(cur.rowcount, f"{member} Left {member.guild.name}, Roles stored into Members") print(cur.rowcount, f"{member} Left {member.guild.name}, Roles stored into Members")
# --------------------------------------------!End Events Section!-------------------------------------------------- # --------------------------------------------!End Events Section!----------------------------------------------

@ -15,15 +15,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
import discord from bot import Bot
from bot import Bot, API_TOKEN
# Initiating Bot Object As Client # Initiating Bot Object As Client
client = Bot() client = Bot()
# Run the bot, allowing it to come online
try:
client.run(API_TOKEN)
except discord.errors.LoginFailure as e:
print("Login unsuccessful.")

Loading…
Cancel
Save