import discord from discord.ext import commands import json import random import os import requests from bs4 import BeautifulSoup from googletrans import Translator with open("setting.json", "r", encoding="utf8") as jfile: jdata = json.load(jfile) #bot = commands.Bot(command_prefix="!") bot = discord.Bot(command_prefix="!") @bot.event async def on_ready(): print(">> Bot is online <<") """ @bot.event async def on_member_join(member): channel = bot.get_channel(int(jdata["Welcome_channel"])) #channel id (not server id) await channel.send(f"{member} join!") @bot.event async def on_member_remove(member): channel = bot.get_channel(int(jdata["Leave_channel"])) #channel id (not server id) await channel.send(f"{member} leave!") """
import asyncio import discord import os from dotenv import load_dotenv load_dotenv() TOKEN = os.getenv('DISCORD_TOKEN') intents = discord.Intents.all() # intents.members = True bot = discord.Bot( intents=intents, description="What's The Flight Plan Bot granted by Tacojesus.", debug_guilds=[181375626245046272] # debug_guilds=[181374963427704833] ) @bot.event async def on_ready(): print(f"Logged in as {bot.user} (ID: {bot.user.id})") print("------") @bot.event async def on_command_error(ctx, error): print(ctx, error) @bot.command()
# -*- coding: utf-8 -*- import config, discord, os, time, requests, yaml from discord.commands import Option from selenium import webdriver from selenium.webdriver.chrome.options import Options from webdriver_manager.chrome import ChromeDriverManager from ftplib import FTP from imap_tools import MailBox # Init bot = discord.Bot(intents=discord.Intents.all()) servers = [ 528346798138589215, # Vampirism.co 692526341987369021 # Dev ] # Presence @bot.event async def on_ready(): await bot.change_presence(activity=discord.Game(name="vampirism.co")) print("Ready!") #------------------------------------------------------------------------------# # Ping @bot.slash_command(guild_ids=servers) async def ping(ctx):
#Base Stuffs import discord, asyncio, subprocess, json, time, itertools from discord.commands import * #DBL Posting import urllib, urllib.request, requests, pymysql #Our Classes import nsotoken, commandparser, serverconfig, splatinfo, messagecontext, ownercmds import vserver, mysqlhandler, mysqlschema, serverutils, nsohandler, achandler import stringcrypt configData = None stringCrypt = stringcrypt.StringCrypt() splatInfo = splatinfo.SplatInfo() intents = discord.Intents.default() intents.members = True client = discord.Bot(intents=intents, chunk_guilds_at_startup=False) commandParser = None serverConfig = None mysqlHandler = None nsoHandler = None nsoTokens = None ownerCmds = None serverVoices = {} serverUtils = None acHandler = None doneStartup = False owners = [] dev = True head = {} keyPath = './config/db-secret-key.hex'
#!/usr/bin/env python3 import discord import re, logging from os import environ from random import randint logging.basicConfig(level=logging.INFO) bot = discord.Bot() COL_CRIT_SUCCESS = 0xFFFFFF COL_EXTR_SUCCESS = 0xf1c40f COL_HARD_SUCCESS = 0x2ecc71 COL_NORM_SUCCESS = 0x2e71cc COL_NORM_FAILURE = 0xe74c3c COL_CRIT_FAILURE = 0x992d22 class DiceResult: def __init__(self): self.title = "" self.desc = "" self.colour = COL_NORM_SUCCESS def RollDie(min=1, max=10): result = randint(min, max) return result def ResolveDice(BonusDie, PenaltyDie, Threshold, DiceString):
import sys sys.path.append('..') import os import discord from discord import Status from aiess import logger from bot import subscriber from bot import prefixes from bot import permissions from bot.settings import API_KEY logger.init() subscriber.load() prefixes.load() permissions.load() bot = discord.Bot(status=Status.do_not_disturb) for filename in os.listdir("./bot/cogs"): if filename.endswith('.py'): bot.load_extension(f'bot.cogs.{filename[:-3]}') bot.run(API_KEY)
# Security variables. TOKEN = os.getenv('BOMBBOT_DISCORD_TOKEN') SPREADSHEET_ID = '1Ra9Ca60nwIlG_aGVS9bITjM94SJ6H5vIocl2SRVEOcM' TRACKING_SPREADSHEET_ID = '1HhomUgsgjhWWg67M54ZY_RP2l2Ns7LiDCszRJE9XMgQ' SCOPES = ['https://www.googleapis.com/auth/spreadsheets'] value_input_option = "USER_ENTERED" bombs_conn = sqlite3.connect('Bombs.db') bombs_c = bombs_conn.cursor() ordnance_conn = sqlite3.connect('PlaneOrdnances.db') ordnance_c = ordnance_conn.cursor() # Setting up intents and initializing bot. intents = discord.Intents(messages=True, guilds=True, bans=True, dm_messages=True, dm_reactions=True, dm_typing=True, emojis=True, guild_messages=True, guild_reactions=True, guild_typing=True, invites=True, members=True, reactions=True) bot = discord.Bot(intents=intents) # Setup for Google Spreadsheet to be able to pull from it. creds = None if os.path.exists('token.pickle'): with open('token.pickle', 'rb') as token: creds = pickle.load(token) if not creds or not creds.valid: if creds and creds.expired and creds.refresh_token: creds.refresh(Request()) else: flow = InstalledAppFlow.from_client_secrets_file('credentials.json', SCOPES) creds = flow.run_local_server(port=0) with open('token.pickle', 'wb') as token: pickle.dump(creds, token) service = build('sheets', 'v4', credentials=creds)