Skip to content

Latest commit

 

History

History
120 lines (94 loc) · 3.48 KB

README.md

File metadata and controls

120 lines (94 loc) · 3.48 KB

Telegram Genshin Menfess

Telegram Genshin Menfess is a Telegram bot for posting user's menfess into a channel that related to Genshin Impact

Table of Contents

Installations

Python 3.8+
Required Packages
python3 -m pip install -r requirements.txt

Setup Environments

Setup a .env file, you can see the example of env variables in the .env-example.

Telegram API Credentials (API ID & API HASH) You can get them by creating API apps here.
API_ID=123123
API_HASH=abcdEFgHiJkl
Telegram Bot API Token (BOT TOKEN) You can get them by creating your own bot in @BotFather.
BOT_TOKEN=123123:abcdeFGHIJKL
Telegram Channel To use this program, you must have a Telegram channel.
You can create it in the Telegram app, once you created it copy the channel username in the .env file and paste to CHANNEL_USERNAME variable.
MongoDB URI You can run MongoDB in your local machine.
Install MongoDB on Windows | Install MongoDB on Ubuntu
MongoDB Database Name You can name everything for your MongoDB Database in the .env file.
Finish Once all variables are sets, rename the .env-example to .env.

How To Run It?

# main.py

import os
import asyncio
from pyrogram import idle
from dotenv import load_dotenv
from motor.motor_asyncio import AsyncIOMotorClient

from menfess import GenshinMF, MongoDB


async def main():
	load_dotenv()
	conn = AsyncIOMotorClient(os.getenv("MONGO_URI"))
	mongo = MongoDB(conn)
	await mongo.init()

	bot = GenshinMF(
		name="Piemon",
		api_id=int(os.getenv("API_ID")),
		api_hash=os.getenv("API_HASH"),
		bot_token=os.getenv("BOT_TOKEN"),
		plugins=dict(root="menfess.bot.plugins"),
		mongo=mongo
	)
	await bot.start()
	await idle()
	await bot.stop()


if __name__ == "__main__":
	asyncio.run(main())

Save the script above as main.py, then start a MongoDB service, then run it by python3 main.py.

Fanarts Source Credits