def main(): mhelp = help.Help() curpath = mhelp.GetCurPath() cfi = cfinfo(curpath + '\\config.ini') cfi.loadConfig() myarg = sys.argv[1] dm = MyDataMaker(cfi, curpath) if (myarg == 'mb'): dm.MakeBaseDataAndSave() elif (myarg == 'mu'): dm.LoadBaseInfo() argstr = sys.argv[4][1:-1] argstrarr = argstr.split(',') argarr = [] for i in argstrarr: argarr.append(int(i)) sstime = sys.argv[2] + ' ' + sys.argv[3] dm.MakeWaterInfos(sstime, argarr, sys.argv[5]) elif (myarg == 'help'): print("产生基础数据:" + "python getdata.py mb") print( "产生用水数据:" + "python getdata.py mu 2018-3-28 08:01:01 [1,3,8,9,11,12,7,5,4,3,1] useWater1.csv" )
def help_clicked(self): """ help window opened :return: """ self.help_form = help.Help() self.help_form.show()
def __init__(self, clArgs=None, argDB=None): import help self.argDB = self.setupArgDB(clArgs, argDB) self.root = os.getcwd() self.logFile = sys.stdout self.help = help.Help(self.argDB) self.help.title = 'Patch Submission Help' self.checkPetscRoot(self.root) self.setupArguments(self.clArgs) return
def setupArguments(self, argDB): '''This method now also creates the help and action logs''' import help argDB = logger.Logger.setupArguments(self, argDB) self.help = help.Help(argDB) self.help.title = 'Script Help' self.actions = help.Info(argDB) self.actions.title = 'Script Actions' self.setupHelp(self.help) return argDB
def initialization_param(self,num_param,action,key_key,user_number_file): obj_initialization,obj_log = cfg.Configuration(),logger.Logger() if num_param == self.help_param and action == "-h": #help() method obj_initialization = help.Help(action) obj_initialization.view_help() elif num_param == self.work_param: #show(), edit(), all() method if action == "--show" or action == "--edit" or action == "--all": if key_key == "-u" or key_key == "-n": return action,key_key,user_number_file,self.stop else: self.stop=True obj_log.loglogged("Not parameter in "+action+ " run with the -h key for help") print "Not parameter in",action," run with the -h key for help" return action,key_key,user_number_file,self.stop else: self.stop=True obj_log.loglogged("Not find action "+action+ " run with the -h key for help") print "Not find action",action," run with the -h key for help" return action,key_key,user_number_file,self.stop
def MakeUserInfos(self): totalUserNum = int(self.xconfig.TotalArea / self.xconfig.AreaPerOne) fm = [] while totalUserNum > self.xconfig.PeoplesPerFamily_max: m1 = random.randint(self.xconfig.PeoplesPerFamily_min, self.xconfig.PeoplesPerFamily_max) fm.append(m1) totalUserNum = totalUserNum - m1 fm.append(totalUserNum) mUsers = [[] for i in range(len(fm))] xhelp = help.Help() for i in range(len(fm)): mUsers[i].append('{}{:04d}'.format(self.xconfig.villagecode, i + 1)) mUsers[i].append(xhelp.GetRandomName()) mUsers[i].append('{}'.format(fm[i] * self.xconfig.AreaPerOne)) self.xUsers = mUsers out = open(self.sPath + '\\users.csv', 'a', newline='') csv_write = csv.writer(out, dialect='excel') csv_write.writerows(mUsers)
import log import tratamento_obd import servidor import sys import getpass import help nome = "log.txt" dado = log.Log(nome) obd = tratamento_obd.Obd("COM6", 38400) sever = servidor.Server() helper = help.Help() if len(sys.argv) < 2: print("nenhuma conta para login especificada") user = str(input("Insira seu login:"******"tentando se conectar em %s", user) user_id = sever.login(user, senha) if not user_id: sys.exit("Falha ao tentar se conectar, verifique sua conexão com a internet") elif user_id == True: sys.exit("Falha ao tentar se conectar, login ou senha invalida") obd.configura_comm() while 1:
import discord import os from dotenv import load_dotenv import help import roles load_dotenv() TOKEN = os.getenv('DISCORD_TOKEN') helpInstance = help.Help() roleInstance = roles.Roles() class BinBashBotClient(discord.Client): async def on_ready(self): print("Connected to Linux/BSD Gaming Discord!") async def on_message(self, message): if message.author == self.user: return if message.content.startswith("bbb help"): await helpInstance.printHelp(message) return if message.content.startswith("bbb roles enter"): content = message.content.split(" ") roleInstance.addDir(message, content[3]) await roleInstance.printDir(message) return if message.content.startswith("bbb roles stop"): roleInstance.removeUser(message) return
from discord.ext import commands, tasks from itertools import cycle import myrefeldebug import myrefeldb import discord import sqlite3 import random import help bot = commands.Bot(command_prefix = commands.when_mentioned_or('!'), help_command=help.Help()) cogs = ['cogs.cog_management', 'cogs.account', 'cogs.world_interaction', 'cogs.player_interaction', 'cogs.dev', 'cogs.item_interaction', ] welcomeMessages = [ 'Myrefel awaits' ] status = cycle([ 'Realms of Myrefel', '!register to get started' ]) # Displays a message when the bot loads, and loads cogs @bot.event async def on_ready(): logFile = open('log', 'w')
def help_slot(self): self.helpWindow = help.Help(self, "prefs.html")
def help_slot(self): self.helpWindow = help.Help(self, "importURL.html")
Author: Jamie Nguyen This is the file you run to get your bot up and running online. The heart of the bot. ''' BOT_PREFIX = '>' BOT_TOKEN = os.environ.get('DISCORD_BOT_TOKEN') FFMPEG_OPTIONS = { 'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn' } client = Bot(command_prefix=BOT_PREFIX, help_command=None) client.add_cog(help.Help(client)) song_queue = [] loop = asyncio.get_event_loop() # Runs when bot starts @client.event async def on_ready(): # Initialization Stage print('------') print(client.user.name + ' is now online.') print('') # Setting up twitter listener twitter_api = twitter_listener.create_api()
def initialization_param(self, num_param, action, key_f, filesystem, key_u, user, key_s, soft, key_h, hard): obj_initialization, obj_log = cfg.Configuration(), logger.Logger() if num_param == self.help_param and action == "-h": #If number param == help_param => help() method obj_initialization = help.Help(action) obj_initialization.view_help() elif num_param == self.report_param and action == "--all": #If number param == report_param => report() method if key_f != "-r": obj_log.loglogged( 'run', 'initialization_param', 'not', 'Not parameter in ' + action + ' run with the -h key for help') print 'Not parameter in', action, 'run with the -h key for help' else: return action elif num_param == self.show_remove_param: #If number param == show_remove_param => remove() or show() method if action == "--remove" or action == "--show": if key_f != "-f" or\ not filesystem or\ key_u != "-u" or\ not user: obj_log.loglogged( 'run', 'initialization_param', 'not', 'Not parameter in ' + action + ' run with the -h key for help') print 'Not parameter in', action, 'run with the -h key for help' self.stop = True return action, key_f, filesystem, key_u, user, self.stop else: return action, key_f, filesystem, key_u, user, self.stop else: obj_log.loglogged( 'run', 'initialization_param', 'not', 'Not find action ' + action + ' run with the -h key for help') print 'Not find action', action, 'run with the -h key for help' return action, key_f, filesystem, key_u, user, self.stop elif num_param == self.add_edit_param: #If number param == add_edit_param => add() or edit() method if action == "--add" or action == "--edit" or "--change": if key_f != "-f" or\ not filesystem or\ key_u != "-u" or\ not user or\ key_s != "-s" or\ not soft or\ not hard or\ key_h != "-h" or\ (soft.isdigit() == False) or\ (hard.isdigit() == False): obj_log.loglogged( 'run', 'initialization_param', 'not', 'Not parameter in ' + action + ' run with the -h key for help') print 'Not parameter in', action, 'run with the -h key for help' self.stop = True return action, key_f, filesystem, key_u, user, key_s, soft, key_h, hard, self.stop else: return action, key_f, filesystem, key_u, user, key_s, soft, key_h, hard, self.stop else: obj_log.loglogged( 'run', 'initialization_param', 'not', 'Not find action ' + action + ' run with the -h key for help') print 'Not find action', action, 'run with the -h key for help' return action, key_f, filesystem, key_u, user, key_s, soft, key_h, hard, self.stop else: obj_log.loglogged( 'run', 'initialization_param', 'not', 'Not action ' + action + ' run with the -h key for help') print 'Not action', action, 'run with the -h key for help'
HELP_TEXTS = { 'description': 'To see a list of commands.', 'help': 'This command will show all the commands available in Yuuto.', 'aliases': ['manual', 'cmds', 'commands'] } intents = discord.Intents.default() intents.members = True # only try to load the env file if found, docker will use actual env vars if os.path.exists('.env'): dotenv.load_dotenv() prefix = os.getenv('PREFIX') or 'y!' bot = commands.Bot(command_prefix=prefix, help_command=help.Help(HELP_TEXTS), intents=intents) @bot.event async def on_ready(): print('Logged on as', bot.user) game = discord.Game('Volleyball') await bot.change_presence(activity=game, status=discord.Status.online) @bot.event async def on_message(message: discord.Message): if message.author.bot: return